here is what i'm trying to do:
Use the forfiles Command in a .cmd script to delete folders from a specified path that are older than e. g. 2 days on a win7 machine.
Edit: The Situation is the following under the path X:\backups are folders which contain daily backups e. g. 25.06.2014 next folder 24.06.2014 and so on.
My questions regarding this are now:
- /d in the help it always stresses --files--. So I'm not sure if this works for folders too.
- especially i'm not sure what it would do in combination with /s. So it would just run through the folders and delete the files - but what if already the parentfolder was too old? On a sidenote the whole concept of recursive is not clear to me and what it means i was not able to find out. It just means going through the folders right?
- If i would go with an IF-Statement then i would have to use 2 Variable @ISDIR and @FDATE. With this solution i don't know how to combine 2 If-Statements in the forfiles command and additionally i'm not sure if @FDATE is again only for files and not folders.
So how to do it right?
Reference of forfiles: http://technet.microsoft.com/de-de/library/cc753551%28v=ws.10%29.aspx
Greetings!