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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

compare 2 files' timestamp

Reply to Message Icon

Original Message
Name: george (by gp)
Date: June 23, 2008 at 19:17:44 Pacific
Subject: compare 2 files' timestamp
OS: xp
CPU/Ram: dell
Manufacturer/Model: 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.


Report Offensive Message For Removal


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

Hi

Are you running under WinXP or Dos prompt.



Report Offensive Follow Up For Removal

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.


Report Offensive Follow Up For Removal

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


Report Offensive Follow Up For Removal







Use following form to reply to current message:

Not Logged In!

You will not be able to post.

Register | Login
   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: compare 2 files' timestamp

Comments:



Results for: compare 2 files' timestamp

dos batch to check file date
    Summary: 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 ...
www.computing.net/answers/dos/dos-batch-to-check-file-date/12627.html

To compare to files in dos
    Summary: I have to compare to files in dos prompt? if they match output should be "Yes " if not out should be "No" Neo is here...
www.computing.net/answers/dos/to-compare-to-files-in-dos/16770.html

File Compare Utility
    Summary: Hi, There is a program called azdiffl.zip that will open two text files and compare them. The file is 4570 bytes. Below is a copy of the readme file. I have not yet reviewed the program but if the rea...
www.computing.net/answers/dos/file-compare-utility/536.html






Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History






Data Recovery Software