I am trying to remove a large number of files from a location (by large I mean over 100000), whereby the action is initated from a web page. Obviously I cou
Some improvements to speed it up in the back end:
Use Directory.EnumerateFiles(..) : this will iterate through files
without waiting after all files have been retrieved.
Use Parallel.Foreach(..) : this will delete files simultaneously.
It should be faster but apparently the HTTP request would still be timeout with the large number of files so the back end process should be executed in separate worker thread and notify result back to web client after finishing.