background

A large number of image files will be saved locally in the test of image collection demo. After a long time, there will be dozens of GB of data, occupying a large amount of disk space. Using Windows’ right click delete is incredibly time-consuming, taking more than 10 hours. Try shift+del and it’s still slow. Also tried the computer butler file shredding function, is also slow. There was no choice but to find another way.

plan

Use the Windows command line tool (DOS instruction) to process.

1. Run the del command to delete files

Del Deletes only files in folders, but does not delete folders.

del /f/s/q dirname
Copy the code

Add the parameter del

/P prompt confirmation before deleting each file. /F Forcibly deletes read-only files. /S Deletes the specified file from all subdirectories. /Q Quiet mode. The deletion of a global wildcard does not require confirmation. /A Select the file to delete based on the properties. Property Description r Read-only A archive S system H Hidden - The prefix indicates "notCopy the code

2. Run the rmdir command to delete the folder

The rmdir file is deleted together with the file.

rmdir /s/q dirname
Copy the code

Attach the rmdir parameter

/s Deletes all subdirectories and files under the directories. /q is the confirmation that No longer asks for Yes or No action when deleting a directory.Copy the code

Del + RMdir is used together as an example

del /f/s/q dirname
rmdir /s/q dirname
Copy the code

The results of

It’s much faster than Windows right click delete or Shift + del.

One day

Use win10 built-in Powershell terminal, use rm instructions, surprisingly fast, absolutely!

rm -r *
Copy the code