I am using the following routine to move files one by one. The idea is to split a large directory (over 600MB) that is full of small .dat files into smaller directories to facilitate burning them to CD's. It worked great during testing when I was using 6 MB chunks, however I want to finish up the app now, so I moved it to the final size of appx 600 MB and it is taking way too long! How can I make this FASTER? Am I up a river here?
Public Shared Sub MoveFiles(ByVal Path As String, ByVal Dest As String)
Dim aFiles() As String = Directory.GetFiles(Path)
Dim s As String
For Each s In aFiles
If GetFolderSizeMB(Dest) < 597 Then 'Check how big the destination folder is getting and make a desicision based on that
File.Move(s, s.Replace(Path, Dest)) 'replace pathnames
My.Computer.FileSystem.WriteAllText(Dest & "\marker.txt", "marker", True) 'Create a file in each directory. A timer running in this particular application checks for this file so as to know when to change to the next step.