Batch File-overwrite existing file newer available

  Sir Radfordin 10:02 26 Aug 2004

Have a situation where a local copy of a file is kept on several PCs. There is a master copy on a server which is changed and updated occasionaly. When the master copy is updated it has to be copied over to the local PCs.

What I would like is a batch file (or something that does the same thing) which would check the last modified date on the master file and if newer than the local file download and replace the local copy before loading.

Any ideas on how to do this?

  Sir Radfordin 15:31 26 Aug 2004

No ideas?

  woodchip 16:01 26 Aug 2004

I know what you want to do but is this a good idea. As something may get changed and mess the original doc up, so you have nothing to fall back to.

  Taff36 16:18 26 Aug 2004

It works in our company with report files, templates and logos. My IT specialist is in tomorrow so I`ll ask him how complicated it is cos` he writes them for me.

  Zak 18:04 26 Aug 2004

Here is a batch file, copy to notepad and then save aaas .bat file:


ECHO Backup of Drive D: (Hard Drive) folder "My DOCUMENTS" (in DOS: MYDOCU~1) to Drive H: (CD-Writer

ECHO (on a UDF-formatted CD-RW)) same folder. All files (*.*) will be copied.

ECHO The files on the target-drive will be overwritten without questioning (Parameter /Y)

ECHO The file attribute 'Archive' will be reset, so that the same file will be only backuped when it was

ECHO changed (Parameter /M) or the archive bit was set manually.

ECHO All (Sub-)folders will be copied (Parameter /S), even if they are empty (Parameter /E)





XCOPY32 E:\MYDOCU~1\*.* L:\MYDOCU~1\*.* /Y/M/S/E

XCOPY32 E:\MYDOWN~1\*.* L:\MYDOWN~1\*.* /Y/M/S/E


REM XCOPY32 E:\FAVORI~1\*.* L:\FAVORI~1\*.* /Y/M/S/E

  Zak 18:07 26 Aug 2004

I have used double spaces between lines so that it posted correctly. Basically you can follow format and use which folders you want to copy and set up appropriate target folders. You need to always use the DOS folder name.

Please post if any of this is unclear.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Alienware 17 R4 2017 review

These brilliant Lego posters show just what children's imaginations are capable of

Mac power user tips and hidden tricks

Comment réinitialiser votre PC, ordinateur portable ou tablette Windows ?