Get files older than 30 days.
forfiles -s -m *.* -d -30 -c "cmd /c echo @file" (All files)
Once results look ok, change echo to delete.
forfiles -s -m *.* -d -30 -c "cmd /c del @file"
Change *.* to * if you want to include directories.
to have a condition
forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==TRUE echo @file is a directory"
Remove all directories from the current directory older than 3 days.
No comments:
Post a Comment