Pretty obvious. I have folder with like 50 folders and about 5-7 entries within each folder. This function took several minutes to remove them. Did I miss something? Is there any way to speed it up?
deleting files is an expensive operation, so I’d assume the function can take a while if you have a lot of files to delete. @kerrishotts any recommendations on speeding up the process?
looks redundant, and maybe failing (causing slowdowns), because you’re already handling the files at this level in filesTask and the sub-folders in foldersTask.
Sorry for the delay, here’s the result of the run:
Cleanup finished in 150323 ms. I removed 510 files and 177 folders with total size of 110Mb.
OS is Windows 10 x64 version 1903.
Directory structure consists of 50 folder, each folder has 1 file and 1-5 folders. Each subfolder contains 4-5 files. So it’s pretty simple structure, production structure will contain a way more files.
One more side effect. When I’m removing a lot of files Runtime Broker starts consuming a lot of cpu and it’s impossible to stop it. It just hangs for several minutes.
Is it possible to add batch delete for folder with files? I don’t see any other ways to clean up temporary files
Something on our list this year is to improve I/O performance (moving a lot of the moving parts to C++), so that might help. I don’t have a finer-grained time frame though.