Computing.Net > Forums > Disk Operating System > compare 2 files' timestamp

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.

compare 2 files' timestamp

Reply to Message Icon

Name: george (by gp)
Date: June 23, 2008 at 19:17:44 Pacific
OS: xp
CPU/Ram: dell
Product: dell
Comment:

Hi, I want to a batch script to compare 2 files' timestamp, (in case a process might have died or locked).
please help. Thanks a lot.



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: June 26, 2008 at 12:36:31 Pacific
Reply:

Hi

Are you running under WinXP or Dos prompt.



0

Response Number 2
Name: george (by gp)
Date: June 26, 2008 at 15:32:22 Pacific
Reply:

I am going to run a dos batch file under XP schedule task, to monitor the apps every N minutes.


0

Response Number 3
Name: dtech10
Date: June 27, 2008 at 13:11:26 Pacific
Reply:

Hi George

Something on these lines help.


@echo off
setlocal enabledelayedexpansion
set Count=1

rem test files
dir > x1.txt
dir > x2.txt

for /f %%a in ('dir /b x1.txt,x2.txt') do call :Check %%~ta

Rem Remove '/' and ':'
set Stamp1=%Stamp1:/=%
set Stamp2=%Stamp2:/=%
set Stamp1=%Stamp1::=%
set Stamp2=%Stamp2::=%

echo %Stamp1%
echo %Stamp2%

if %Stamp1%==%Stamp2% (echo OK) else (echo Don't Match)

rem del x?.txt
exit /b

:Check %1 %2
set Stamp!Count!=%1%2
set /a Count+=1
exit /b


0

Sponsored Link
Ads by Google
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: compare 2 files' timestamp

dos batch to check file date www.computing.net/answers/dos/dos-batch-to-check-file-date/12627.html

To compare to files in dos www.computing.net/answers/dos/to-compare-to-files-in-dos/16770.html

File Compare Utility www.computing.net/answers/dos/file-compare-utility/536.html