Computing.Net > Forums > Windows XP > how to compare two dates in bat DOS

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

how to compare two dates in bat DOS

Reply to Message Icon

Name: dosuserdos
Date: May 22, 2007 at 00:50:44 Pacific
OS: winxp
CPU/Ram: p4 and 2 GB
Comment:

can Anybody tell me how to compare dates in dos.
Actually my requirement is I want to delete all the directories which are three days old.

My Dir name is like this:-

BackUp 05-21-2007

please help


DOS user dos



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: May 22, 2007 at 07:27:10 Pacific
Reply:

Since you are using XP and not pure DOS, there is no lack of tools that can find the date for you. eg of some of them are Perl/Python..which are better than batch to do such things. If you are not restricted to only batch, you can download Windows services for Unix at http://technet.microsoft.com/en-us/...
It brings Unix to Windows environment. Once you installed, you can just use the korn shell and do this:
find /dev/fs/C -type d -mtime +3 -print. This will print out the directories that are more than 3 days in your C drive. To remove them, you can pipe to rm command:
find /dev/fs/C -type d -mtime +3 -print | xargs rm -f


0
Reply to Message Icon

Related Posts

See More


File extension Ping command in XP



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: how to compare two dates in bat DOS

How to enable the built in ftp server? www.computing.net/answers/windows-xp/how-to-enable-the-built-in-ftp-server/287.html

start in ms-dos mode www.computing.net/answers/windows-xp/start-in-msdos-mode/87828.html

How to network two machines www.computing.net/answers/windows-xp/how-to-network-two-machines/143008.html