Ask Experts Questions for FREE Help !
Ask
    fregoton's Avatar
    fregoton Posts: 1, Reputation: 1
    New Member
     
    #1

    Jul 22, 2014, 03:51 AM
    How to delete Folders and Files that are older than x number of days using batch
    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.
    [MENTION=21871]Echo[/MENTION] OFF
    ECHO
    forfiles /p C:\Temp /s /m *.* /d -30 /c "cmd /c del echo [MENTION=36112]FIL[/MENTION]E"
    EXIT
    NeedKarma's Avatar
    NeedKarma Posts: 10,635, Reputation: 1706
    Uber Member
     
    #2

    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).

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Batch file- Copy current date files [ 3 Answers ]

Dear experts, How do I create a dos batch file to copy only todays(current date) files from the directory.

I can't delete folders [ 6 Answers ]

I have no idea why. I was hoping someone could explain to me why there are several folders inside of a particular folder that I can't delete. The error I get when I try is "The operation cannot be completed because the file is in use." There is no file in the folder though. Is there anyway to get...

Batch files, add/remove programs check possible? [ 1 Answers ]

Hello, :confused: I am wondering if it is possible to have a batch file check the applications that are installed by checking add/remove programs? Or Maybe there is an easier way to accomplish this check with a batch file? Thanks for all of your time.


View more questions Search