Discussion Locked

Batch file help

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Does anyone have some sample code I could look at that would compare the created date of a file and copy a newer one to that location? Also to append a text file to show the names of computers that were not accessible or were not found,,,etc during the file check and/or copy process.

Cheers
John

5 replies

by jeff adams

If you are wanting to copy only newer files, instead of trying to figure out date comparisons in batch, why not use 2000's replace command with the /U (update) switch? This will update only existing files that are older than your source file.

Asfor logging, that should be able to be handled by redirecting output. If you have a predetermined list of computers to run the replace against, those can be read from a file (in batch) and processed accordingly.

-Jeff

by gperrie

To copy only newer versions of files you could use

xcopy /D

with no date after the D.
Gavin

This discussion is closed to new replies.