Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've just wiped my laptop and am starting to move files back on to it now. How can I keep certain folders clean automatically? For example, is there an easy way to automatically deletes all of the contents in a folder older than 2 weeks, and have this process run daily? That would really help in keeping things like my downloads folder from filling with junk.

This is on Windows 7 64-bit.

share|improve this question
    
What operating system are you using? –  Daniel Beck Aug 6 '12 at 17:13
    
Windows 7 64-bit. Added that to the question. That little detail somehow always slips my mind. –  Nick Anderegg Aug 6 '12 at 17:24

1 Answer 1

up vote 1 down vote accepted

You create batch script that deletes content of download folder. And then create windows version of cron and run it on designated intervals.

Batch to delete contents of my folder.

FOR /D %%i IN ("D:\myfolder\*") DO RD /S /Q "%%i" DEL /Q "D:\myfolder\*.*"

Delete folders older than N

forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path"

Forfiles documentation: http://ss64.com/nt/forfiles.html

And cron for windows: http://support.microsoft.com/kb/308569

share|improve this answer
    
Is there a way to do it with deleting files older than X days? –  Nick Anderegg Aug 6 '12 at 17:36
    
@NickAnderegg I updated my answer. –  Sandro Dzneladze Aug 6 '12 at 17:42
    
I think this will work, thanks! –  Nick Anderegg Aug 6 '12 at 17:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.