Windows delete multi-level directory

  

There are currently 99 folders under the folder d:\\clu_1, the name is 0, 1..99, there are 25 folders under each folder, the folder name is 0,1,....24, under which there are folders named after the date (such as 20140521), and finally the zip file. For example, a zip file path d:\\clu_1\\88\\23\\20140521\\Raw_0432.zip.

These files have taken up 7T. Now you need to delete some files. There are 2 methods:

1. Delete only the innermost zip file by time, such as deleting files before 20140608. (including 20140608), the command is as follows:

forfiles /pd:\\clu_1 /s /m *.zip /d -2014/06/08 /c "cmd /c del /q /s @path"

Disadvantages This command does not delete the directory

2. Delete by directory name, such as deleting the folder of May and all the files under it

for /rd: \\clu_1 /d %i in (201405*) do rmdir /q /s %i

Delete the folder starting with 201405, ie delete the data of May, as another:

For /rd:\\clu_1 /d %i in (20140608*) do rmdir /q /s %i

Delete the folder starting with 20140608, ie delete the data of June 8;

Note: If there are a lot of folders, after entering the command, you will see a response after a while.

Copyright © Windows knowledge All Rights Reserved