Deleting a folder that contains many items or a deep hierarchy can take a long time. Currently, PowerShell results in using a .NET API call to remove the top level folder which internally, probably calls a Win32 API (on Windows, of course) to delete that folder which serially handles it. There is an OSS tool byenow which scans the folder/file hierarchy and leverages multiple threads which results in a significant perf gain (for large folders) and even more so for remote deletes. It seems we can use a similar strategy in the FileSystemProvider when there is a recursive delete on a folder.
Wouldn't it advantageous to enhance Copy-Item -Recurse in a similar fashion? Obviously the searching and thread pooling approaches differ (top-down versus bottom-up), but they are in the same ballpark.
We do manual enumerating with PowerShell magics.
We need to add more tests before changing something.
Most helpful comment
Wouldn't it advantageous to enhance Copy-Item -Recurse in a similar fashion? Obviously the searching and thread pooling approaches differ (top-down versus bottom-up), but they are in the same ballpark.