Could Anybody Make This Shorter or Better? xcopy or Robocopy?

iiTzzDeFuze

Honorable
Jun 1, 2013
395
0
10,960
I'm currently using xcopy but I know there is also RoboCopy but I don't know which one is better to use and HAS MORE OPTIONS. I know that windows has its own backup thing but I would like to use this.

@echo off
:: variables
set backupdir=E:\BackedUpFiles
set backupcmd=xcopy /s /c /d /e /h /i /r /y

%backupcmd% "C:\Users\YourAccount\Something" "%backupdir%\Documents"
 
Solution
Would It be something like this. I'm not sure if i am getting this right. BTW i am doing this for just important pictures and documents and other crap.

@echo off

echo This script will be executed daily, to backup following folders:

echo Source -> \\server\Backup


rem /mir Mirror directory structure

rem /log+: Append log to file

rem /log: Create log file

rem /np Do not write progress to file

rem /tee Display on console as well

rem /R:10 /W:10 Retry 10 times failed copy operations, wait 10 seconds between them


robocopy C:\Users\XXX\Documents\Important Docs /mir /R:10 /W:10 /log:D:\Temp\Backup2Server.log /np /tee

copy /y E:\BackedUpFiles
This is how I use RoboCopy for backups. The script itself is being executed on a regular basis from the Task Scheduler.
Code:
@echo off
echo This script will be executed daily, to backup following folders:
echo Source -> \\server\Backup

rem /mir   Mirror directory structure
rem /log+: Append log to file
rem /log:  Create log file
rem /np    Do not write progress to file
rem /tee   Display on console as well
rem /R:10 /W:10 Retry 10 times failed copy operations, wait 10 seconds between them

robocopy D:\Source \\Server\Backup /mir /R:10 /W:10 /log:D:\Temp\Backup2Server.log  /np /tee
copy /y D:\Temp\Backup2Server.log \\Server\Backup
 

iiTzzDeFuze

Honorable
Jun 1, 2013
395
0
10,960
Would It be something like this. I'm not sure if i am getting this right. BTW i am doing this for just important pictures and documents and other crap.

@echo off

echo This script will be executed daily, to backup following folders:

echo Source -> \\server\Backup


rem /mir Mirror directory structure

rem /log+: Append log to file

rem /log: Create log file

rem /np Do not write progress to file

rem /tee Display on console as well

rem /R:10 /W:10 Retry 10 times failed copy operations, wait 10 seconds between them


robocopy C:\Users\XXX\Documents\Important Docs /mir /R:10 /W:10 /log:D:\Temp\Backup2Server.log /np /tee

copy /y E:\BackedUpFiles
 
Solution