Using FORFILES to delete subdirectories from target directory
Posted on 2011-05-02
Given a target directory, C:\TEST with 2 sub-directories;
Using a command such as
FORFILES -pC:\Test -m*.* -s -d-30 -c"CMD /C del /q @FILE"
I am able to delete all files within the 2 sub-directories which satisfy the age parameter.
Instead of processing the files within the sub-directories, is there a way to process the sub-folders and accordingly delete the sub-folders given an age parameter is met?
In other words, deletion is by sub-folders, regardless of age of the files within.
I have tried removing the recurse sub-directory switch, -s . But it does not seem to help.
Any suggestion from an Expert would be greatly appreciated.