File before the recursive delete N days folders and subfolders under a particular file

OFF @echo
REM setting is deleted folder path
SET srcdir = D: \ tmp \ Test \
REM setting file save days
SET = 2 Days
REM / file search path specified p / s search subdirectories / m specified format, default for*.*

rem / d to select the file, a modification which date is greater than or equal to (+), or less (-) with the format specified date "yyyy / MM / dd"; or select a file, a modification which date is greater than or equal to (+ ) the current date plus "dd" days, or less than or equal to (-) the current date minus "dd" days. The number of days "dd" may be 0 - any number in the range of 32,768. If not specified, "+" is used as the default symbol.

rem / c command specifies execution
rem del command (delete files, not folders) / p prompted for confirmation before deleting each file / f force delete / q is not asked to delete the / a specified attributes Delete / s removed from all subdirectories specified file

forfiles /p %SrcDir% /s /m *.txt /d -%Days% /c "cmd /c del /f /q /a @path"
rem pause

 

Guess you like

Origin www.cnblogs.com/mediocreWorld/p/11037991.html