Batch command for deleting both folders and contents order than 30 days [Solved]

Report
Posts
2
Registration date
Saturday February 1, 2020
Status
Member
Last seen
February 3, 2020
-
David Webb
Posts
921
Registration date
Monday November 25, 2019
Status
Administrator
Last seen
April 4, 2020
-
Please help with Batch command for deleting both folders and contents order than 30 days , the command i have only deletes contents but not the folders

1 reply

Posts
921
Registration date
Monday November 25, 2019
Status
Administrator
Last seen
April 4, 2020
1,122
Hello, a similar question was asked and answered in this forum post.

The best answer was the following:

Try the following command to automatically delete files at the root of a directory. This command can be saved in a .bat file and scheduled with scheduled tasks.

forfiles /p "PATH" /s /d -30 /c "cmd /c del @file : date >= 30 days >NUL"

Change "PATH" with the path where you want the files to be deleted. If there are no spaces in the path you dont need the "-symbol.


Let me know if that helps!

2
Thank you

Glad we were able to help! Love us? Write us a review! Rate CCM

CCM 4131 users have said thank you to us this month

gmwenechanya
Posts
2
Registration date
Saturday February 1, 2020
Status
Member
Last seen
February 3, 2020

Thank you so much...it worked!!!
David Webb
Posts
921
Registration date
Monday November 25, 2019
Status
Administrator
Last seen
April 4, 2020
1,122 > gmwenechanya
Posts
2
Registration date
Saturday February 1, 2020
Status
Member
Last seen
February 3, 2020

Brilliant! Happy to have helped!