MS-DOS

Moderators: blip
Number of threads: 389
Number of posts: 904

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
File date/time comparison commands? Posted by areid on 4 Feb 2005 at 12:26 PM
I am trying to create a batch file in which the date/time of a file is compared with another file (of the same name) in another folder. If the date/timestamp has changed, the newer file is copied over to overwrite the older file.

I'm sure this can be achieved using good old-fashioned batch-file commands, but I'm not sure how to go about it.

Any help would be appreciated.

Alan Harris-Reid
BaseLine Data Services (UK)
Report
Re: File date/time comparison commands? Posted by renegade_havoc on 25 Feb 2005 at 10:25 AM
What DOS version are you using? There's a difference in writing batch files (or scripts) for Win9x & earlier versions and for those running newer OSs.



: I am trying to create a batch file in which the date/time of a file is compared with another file (of the same name) in another folder. If the date/timestamp has changed, the newer file is copied over to overwrite the older file.
:
: I'm sure this can be achieved using good old-fashioned batch-file commands, but I'm not sure how to go about it.
:
: Any help would be appreciated.
:
: Alan Harris-Reid
: BaseLine Data Services (UK)
:

Report
Re: File date/time comparison commands? Posted by areid on 25 Feb 2005 at 1:26 PM
: What DOS version are you using? There's a difference in writing batch files (or scripts) for Win9x & earlier versions and for those running newer OSs.

Win XP

Regards,
Alan
Report
Re: File date/time comparison commands? Posted by Phat Nat on 5 May 2005 at 12:01 AM
: I am trying to create a batch file in which the date/time of a file is compared with another file (of the same name) in another folder. If the date/timestamp has changed, the newer file is copied over to overwrite the older file.
:
: I'm sure this can be achieved using good old-fashioned batch-file commands, but I'm not sure how to go about it.
:
: Any help would be appreciated.
:
: Alan Harris-Reid
: BaseLine Data Services (UK)
:


Try "XCOPY /D <source> <destination>"

Only copies newer files. Under a DOS window, type "HELP" for a list of commands and/or "XCOPY /?"

Greets,
Phat Nat

Report
Re: File date/time comparison commands? Posted by areid on 5 May 2005 at 1:46 AM
Phat Nat, thanks for the reply.

: Try "XCOPY /D <source> <destination>"

That does the trick! I'd completely forgotton about XCOPY - just goes to show how long it is since I've copied using DOS commands.

Regards,
Alan



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.