3 ms·
Does anyone know how PowerShell compares to cmd.exe for this particular problem? In PowerShell, one would type: rm -Recurse -Force $path It has the advantag
by krylon 9y ago
Does anyone know how PowerShell compares to cmd.exe for this particular problem? In PowerShell, one would type:
rm -Recurse -Force $path
It has the advantage that it only takes a single command, but I am not entirely certain about the performance.
- jdmichal 9y agoMy experience has been that Powershell is as fast as cmd for this task. EDIT: As a test, I cloned my local Maven repository a few times. This resulted in 48,613 files, 16,590 folders, and 2.71 GB on disk. Here's the result of: Measure-Command { rm '.\.m2 - Copy' -Recurse -Force } TotalDays : 0.00196887874421296 TotalHours : 0.0472530898611111 TotalMinutes : 2.83518539166667 TotalSeconds : 170.1111235 TotalMilliseconds : 170111.1235 ~~And it had a CPU pegged the entire time. So no, Powershell is still terrible at this. Stick with cmd.~~ EDIT2: Tried it again, with RMDIR and using the timing script found here: https://stackoverflow.com/a/6209392 https://stackoverflow.com/a/6209392 timecmd "RMDIR /S /Q .m2c > NUL" command took 0:2:40.15 (160.15s total) So within the same magnitude of time. I might try it one more time after lunch with the DEL followed by RMDIR combo to see if that changes anything.
- maxxxxx 9y agoIt's either same speed or slower. I once wrote a commend line delete tool with Win32 and threading. That was quite a bit faster than the built in delete commend.