PC Review


Reply
Thread Tools Rate Thread

Comparing dates of two files in DOS batch (Windows 2000)

 
 
BertieBigBollox@gmail.com
Guest
Posts: n/a
 
      29th Jun 2006
whats the easiest way to do this?

Basically, what I want to do is compare the dates of two files (call
them file1 and file2). If file2 has a more recent date than file1, then

file2 should overwrite file1.


The application we run has got a sort of scheduled jobs thing so we
will be using this. It can execute a dos batch file or any executable.
If its easily done in a dos batch file this would be easy I guess.

 
Reply With Quote
 
 
 
 
foxidrive
Guest
Posts: n/a
 
      29th Jun 2006
On 29 Jun 2006 04:44:03 -0700, (E-Mail Removed) wrote:

> whats the easiest way to do this?
>
> Basically, what I want to do is compare the dates of two files (call
> them file1 and file2). If file2 has a more recent date than file1, then
>
> file2 should overwrite file1.
>
>
> The application we run has got a sort of scheduled jobs thing so we
> will be using this. It can execute a dos batch file or any executable.
> If its easily done in a dos batch file this would be easy I guess.



@echo off
xcopy "c:\file2.ext" "d:\file1.ext" /d /y
 
Reply With Quote
 
Stealth
Guest
Posts: n/a
 
      30th Jun 2006
If you have access to the Windows Resource toolkit, use robocopy.

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> whats the easiest way to do this?
>
> Basically, what I want to do is compare the dates of two files (call
> them file1 and file2). If file2 has a more recent date than file1, then
>
> file2 should overwrite file1.
>
>
> The application we run has got a sort of scheduled jobs thing so we
> will be using this. It can execute a dos batch file or any executable.
> If its easily done in a dos batch file this would be easy I guess.
>



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      2nd Jul 2006
In alt.msdos.batch.nt foxidrive wrote:

> On 29 Jun 2006 04:44:03 -0700, (E-Mail Removed) wrote:
>
>> whats the easiest way to do this?
>>
>> Basically, what I want to do is compare the dates of two files
>> (call them file1 and file2). If file2 has a more recent date
>> than file1, then
>>
>> file2 should overwrite file1.
>>
>>
>> The application we run has got a sort of scheduled jobs thing
>> so we will be using this. It can execute a dos batch file or
>> any executable. If its easily done in a dos batch file this
>> would be easy I guess.

>
>
> @echo off
> xcopy "c:\file2.ext" "d:\file1.ext" /d /y


Other notes:
the obscure REPLACE.EXE command for some conditions
DIR /O if using a sensible Date format such as YYYY-MM-DD
may be useful in some conditions.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Batch Files in Access 2000 Ant Microsoft Access Macros 4 8th Jul 2008 11:08 PM
Batch files and dates Jan Krumsiek Microsoft Windows 2000 Developer 4 16th Aug 2007 07:11 AM
Batch Files Stop Executing with Windows 2000 Jason Barona Microsoft Windows 2000 3 26th Jan 2004 05:12 PM
Learning Windows 2000 batch JClark Microsoft Windows 2000 CMD Promt 9 3rd Sep 2003 06:32 PM
Batch convert XP files to 2000? joey Microsoft Excel Misc 1 27th Aug 2003 08:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:11 AM.