Computing.Net > Forums > Disk Operating System > dos batch to check file date

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

dos batch to check file date

Reply to Message Icon

Name: desi
Date: February 4, 2003 at 12:15:33 Pacific
OS: win2k
CPU/Ram: p4/512
Comment:

can someone help me i need a dos batch file to check 2 files timestamps are = today date. if one file is not than call another batchfile.

thanx



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: February 5, 2003 at 07:34:47 Pacific
Reply:

I hope I understood what you want; if so try the following script. It checks the timestamp of the files keyed into the command line and jumps to the Batch_File if only one has not the today date.
Substitute [Batch_File_Name] with the name of batch witch you will jump to.

@Echo Off

:: CompDat.Bat Syntax: CompDat FileName [FileName] [FileName] ...

For /F "Tokens=2 Delims= " %%a in ('Date /T') Do Set ToDay=%%a

:LOOP
If "%1"=="" GoTo EXIT
Dir %1 /A:-D /X | Find "%ToDay%" > Nul
If ErrorLevel 1 [Batch_file_Name]
Shift
GoTo LOOP

:EXIT
Echo.
Echo All Files have %ToDay% TimeStamp
Set ToDay=

The script works only under Win NT/2K/XP.


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: dos batch to check file date

DOS batch to check file dates www.computing.net/answers/dos/dos-batch-to-check-file-dates/13578.html

dos batch to ftp files www.computing.net/answers/dos/dos-batch-to-ftp-files/1727.html

Printing From A DOS App. To A File www.computing.net/answers/dos/printing-from-a-dos-app-to-a-file/1730.html