I have a console application that will take about 625 days. If there is a way to do it faster.
Firstly, I work in a directory that has about 4,000,000 files, if not more. I work in a database that has a row for each file, and then some.
Now working with SQL is relatively fast, the bottleneck is that I use File.Move() for each move it takes 18 seconds.
Is there a faster way than File.Move() ?
This is the bottleneck:
File.Move(Path.Combine(location, fileName), Path.Combine(rootDir, fileYear, fileMonth, fileName));
All other code is pretty fast. All I have to do is move one file to a new location and then update the database location field.
I can show other code if necessary, but in fact the above is the only current bottleneck.
source share