Robocopy in a Batch File

Hewlett-packard SERVER
September 28, 2009 at 15:59:04
Specs: Windows 2003 Server, Quad Core / 4Gig
I am trying to make a script to copy the users local files every 6 hours. I got one that works but I want to modify it so that it only does differential copies to save disk space. Here is the code I have...

@echo off
Set Monthfolder=Monthly\%Date:~-4,4%-%Date:~-10,2%
Set Dailyfolder=Daily\%Date:~-4,4%-%Date:~-10,2%\%Time:~-11,2%;%Time:~-8,2%;%Time:~-5,2%

@echo Backing up local files...

@\\\scripts\robocopy "%userprofile%" \\\backups\userfiles\%username%\%Dailyfolder% *.do* /if *.xl* /if *.pdf /if *.pp* /if *.txt /XD %userprofile%\AppData /XD "%userprofile%\Application Data" /s /COPY:DAT /r:1 /w:1 /np > h:\BackupLog.txt
@\\\scripts\robocopy "%userprofile%" \\\backups\userfiles\%username%\%monthfolder% *.pst* /XD %userprofile%\AppData /XD "%userprofile%\Application Data" /s /COPY:DAT /r:1 /w:1 /np >> h:\BackupLog.txt

Need a robocopy expert.

See More: Robocopy in a Batch File

Report •

September 28, 2009 at 20:02:27
Try tossing the "/xo" argument in your string. That will only copy files newer than the destination version.

Report •

September 30, 2009 at 09:22:14
I need it to compair with an old directory or a master copy and only backup the files that where changed like a differential but more of a shadow copy.

Report •

September 30, 2009 at 13:57:48
Ok, after thinking about this what I have come with is that I need to somehow log what was backed up and compare the date time for changes and only backup what has changed. So not just a differential but a shadow copy.

Report •

Related Solutions

Ask Question