The below deletes all files from c:temp older than 10 days:
FORFILES /p “c:temp” /m *.* /c “cmd /c Del /F /Q @path” /d -10 /s
The below deletes all folders from c:temp older than 10 days:
FORFILES /p “c:temp” /S /D -10 /C “cmd /c IF @isdir == TRUE rd /S /Q @path”
Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.
Thank you Sir. When I try this command it leaved temp files and Empty folders undeleted