Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
DOS/Other
Tag Cloud
access acer asus bios bsod crash desktop driver drivers error ethernet excel freeze games gaming hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network printer problem ram random registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/Other >
Solved: Deleting Folders older than 30 days from date.

Reply  
Thread Tools
dcohn's Avatar
Junior Member with 2 posts.
 
Join Date: Jan 2010
29-Jan-2010, 07:42 PM #31
Forfiles is the best solution

It can delete directories using this format

forfiles -pc:/BACKUP -mTemp -s -c"CMD /C if @ISDIR==TRUE RD/s"

You would need to use the date portion if the command of course.
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
29-Jan-2010, 11:58 PM #32
Quote:
Originally Posted by dcohn View Post
Forfiles is the best solution

It can delete directories using this format

forfiles -pc:/BACKUP -mTemp -s -c"CMD /C if @ISDIR==TRUE RD/s"

You would need to use the date portion if the command of course.
I had suggested that earlier in the thread but the user wants to delete based on Created Date, not modified date.
dcohn's Avatar
Junior Member with 2 posts.
 
Join Date: Jan 2010
30-Jan-2010, 08:44 PM #33
Understood. Sorry I missed that.

Personally I would be a little uncomfortable with this script.

Seems too complex for the task for my taste. I would try to find a more suitable tool for the solution.

In this case I would use JPSoft Take command instead of the built in command processor. The free TCC LE version has the date commands built in along with options for using create instead of modified dates. I am not 100% sure the free version does all you need but I believe it may.

http://jpsoft.com/help/dateranges.htm
http://jpsoft.com/help/del.htm?zoom_...delete+by+date

Here is an example line that would delete files and empty subfolders that 10 days or older by create date. It would exclude folder.cfg and include hidden and read only.

del /[dc-10,1/1/80] /[!folder.cfg] /s /x /y i:\*.*

You can do anything in TakeCommand TCC. There is no scripting product better suited for this type of work within windows. Noty even PowerShell has the power of TakeCommand. It allows you to create your own functions, aliases and plugins. Very well supported product as well.

http://jpsoft.com/ If anyone knows of another product with the same power, flexibility, STABILITY and support please let me know.

I recently found this tool that may work for just the deleting aged files but unsure because I have not tested. TCC can be a lot of work initially and unless you require the command processor often it may be overkill.

http://home.mnet-online.de/horst.muc/win/delage.htm

Quite nice really if it suits your need. Deletes by date but no folders unless empty. Perfect for a task I have that must parse through a folder structure with 3 million files and delete those over 95 days. Just unsure I can use it in 64 bit windows. Going to test.

Also if you have access to Experts Exchange there is a very simple vbscript and a Cmd batch file similar to what you wrote but more compact. It may not do what you need precisely though it does have the create date code.

http://www.experts-exchange.com/OS/M..._24129205.html

Last edited by dcohn; 30-Jan-2010 at 09:28 PM..
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
31-Jan-2010, 02:34 PM #34
Swiss File Knife is one of my favorite cmd line tools. I think it could probably accomplish this task as well but I am not sure.
http://stahlworks.com/dev/swiss-file-knife.html
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:17 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.