I'm trying to developing a purging process but I haven't been able to land on anything that I really like yet so wanted to get your opinion. What is the best way to go about this?
Can I merely just use a forfiles to remove an entire directory based on AGE, or should I remove files first and then the folder/subfolders?
I have this piece of code:
Code: Select all
FORFILES /P "D:\Data\Imports" /S /M "*" /D -14 /C "CMD /C if @ISDIR==TRUE echo RD /S /Q @PATH"
I understand my above code will not purge empty dirs, so in the case, I planned to just use a ROBOCOPY to take care of that.
Code: Select all
ROBOCOPY "D:\Data\Imports" "D:\Data\Imports" /S /MOVE