views:

60

answers:

2

Hi everyone,

Please suggest me a C# cross-platform solution to copy a File with progress. The method should be able to copy the file on Mono as well on .NET.

P.S. Most of the solutions here refers to CopyFileEx (which uses PInvoked and I am not sure if this will works on a Mono)

P.S.S. Many thanks in advance!

-- Murat

A: 

Did you try File.Copy method? I have no experience with mono, but think that it should work. You will have to worry about file paths, which is different from API.

Sudesh Sawant
+4  A: 

You can manually copy between filestreams, like the CopyFile method in MonoDevelop's file deployer, which has a callback after every 1k chunk.

It's probably a fair bit slower than File.Copy, but if progress callbacks are essential you don't have much choice. In the case of the MonoDevelop file copier, we write to locally-mounted remote file systems via FUSE.

mhutch
Thanks Michael.
Murat