简体   繁体   中英

Accelerating file deletion on windows

I wish to delete a lot of files on windows quickly as possible. Got any suggestions on how to do it (in batch script, windows command or ant script etc.)?

I was thinking of the following directions:

  1. Parallel deletion. It apperats that when I delete a bunch of files it takes longer than deleting groups of these files parallely.

  2. Any (quick!) way to make these files on creation time to "sit" closely on the disk?

  3. Any optimizations in deletion, given that the deletion is permanat?

  4. Any lazy mechanism windows has. That is, it doesn't really delete the files at that moment, but creates the effect that it did (you won't see it on the cmd.exe dir command or on the gui, and you could create a new file with a name that used to exist etc.) and windows will continue the real deletion in the background.

Any input will be extremely helpfull, Thank you.

I find that the command line tends to be faster with file operations. For example, to delete C:\\Parent\\Folder\\OldFolder , open the Command Prompt and type:

CD "C:\Parent\Folder"
Attrib -R -S -H "OldFolder\*.*" /S /D /L
RD /S /Q "OldFolder"

You could try using the commmand line as Hand-E-Food said. You can use these commands to delete files and remove folders.

del /f /s /q
rd /s /q

Or use wildcards to wipe all files out from a directory:

del C:\filestodel\*.* /f /s /q

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM