I am having issues making this syntax work correctly. What I would like to do is remove all tmp and bak files from the specified directory and all subdirectories if the modified date is older than 7 days.
for %G in (.tmp, .bak) do forfiles -p "C:\test\cad projects" -s -m *%G -d -7 -c "cmd /c del @path"
My syntax was gathered from this StackOverflow question.
If I change my search mask to only include one desired extension then I get correct results.
forfiles -p "c:\test\cad projects" -s -m *.bak -d -7 -c "cmd /c del @path"
I don't do much with batch files so I was hoping someone could assist. Thanks for reading.