Backup Script
I want to get files copied from a fileserver to a NAS nightly. The details from the batch file I have been using are below. It seems as though each time the script runs, it recopies every file, rather than just new or changed files, and it is also stopping before all folders have been copied. Any ideas on why this might be occurring? Is the script wrong or is there a better way to handle this? I want the file structure reproduced on the NAS, not just a single backup file of the fileserver data. @echo on for /f "delims=" %%a in ('xcopy /s /c /d /e /h /i /r /k /y "D:\FOLDER" "\\NAS\FOLDER"") do ( echo/%%a echo/%%a >>Backup.log) :exit @pause Thanks for any advice.
July 8th, 2010 4:26pm

Hi Zman21 try to use robocopy with the /mirror option instead: robocopy D:\folder \\nas\folder /mir /LOG:backup.log Ralf
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 4:44pm

Thanks Ralf. If I remove the /mir option, Robocopy will, by default, only copy new/changed files in the source, but will not delete files from the destination that no longer exist in the source, correct?
July 8th, 2010 5:37pm

Hi zman21, Yes, nearly. /mir is equivalent to /e + /purge. /e is to copy empty directories. No matter if /e is specified or not robocopy wont copy unmodified files. Ralf
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 6:56pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics