Log in

View Full Version : How to delete Folders and Files that are older than x number of days using batch


fregoton
Jul 22, 2014, 03:51 AM
Hi,

I was searching an answer for this question but I was only able to find this batch code that deletes files but not folders is there any way I can also delete folders in a specific date in a windows directory.
Echo OFF
ECHO
forfiles /p C:\Temp /s /m *.* /d -30 /c "cmd /c del echo FILE"
EXIT

NeedKarma
Jul 22, 2014, 05:49 AM
Unless you really want to stick with a command line solution to me the best solution is to use Windows Explorer and set the View to Details, then sort the Date Modified column (or any other date column you wish to use).