Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am currently in the process of creating a file copy process for thousands of files in one go. I want to know if there is any .net library that would help me accomplish this task with the least amount of wait time.
Posted

I don't think you need anything except System.IO.File.Copy. I don't know how you need to define the file set for copy, but you could use he System.IO.Directory. In practice, especially for UI applications, you would need to use a separate thread for such operations.

—SA
 
Share this answer
 
I've spent some time on this. Don't be afraid to use multiple threads for your copy operations, even though you will find some sources which claim this is not faster. It's not true - just look at Robocopy.

In fact, Robocopy may be your whole solution.

-Pete
 
Share this answer
 
Comments
Philippe Mori 27-Jan-14 21:16pm    
Too much multithreading can definitively kill performance as as disk heads will move more. This is relatively easy to see even just using Windows Explorer and starting a bunch of copy that uses same drives.
pdoxtader 28-Jan-14 9:48am    
Have you ever written a file copy application to test this yourself? Don't trust microsoft's native application. You don't know what they're doing besides copying bytes from one location to another. Do it YOURSELF.

I have, and I was able to see a performance benefit while copying as many as 500 files at once. To my surprise, I discovered that the real delay in copying files wasn't reading and then writing the bytes - it's in the file creation itself (for smaller files - this is a surprisingly complicated subject).

Don't just take what you see using Microsoft utilities (or on MSDN) as the bottom line. Do it yourself. Test it yourself.

-Pete

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900