4
Answers

Fastest way to copy files?

Ask a question
Noah NU

Noah NU

14y
6.7k
1
Hello, I have 4 folders. In folders 1, 2 and 3 I have average 300 MP3 files. A third party application will play the MP3 files from the Main directory. When a button is clicked I want all the contents of the corresponding folder to be copied to the Main directory.

Main
1
2
3

At the moment I am using System.IO.File.Copy() and System.IO.Directory.GetFiles() to copy all the files from the specified directory to the Main directory. Before I copy the files over I delete the existing files in the Main directory.

My current way of accomplishing this task is taking up to 10 minutes because of the need to copy large quantities of files.

Now I have two questions (in order of priority):
Is there a FASTER means of copying these files?
During the copying of the files is there a way to prevent my UI from freezing (waiting for the file transfers to complete)?

Answers (4)