[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now



Posted on 2006-03-21
Medium Priority
Last Modified: 2012-05-05

I am looking to replicate a shared directory on an WinXP internal volume to a external USB/Firewire drive twice daily as a removable backup solution.

I have been looking into using Robocopy.

Has anyone used this utility and if so can you give a starting syntax to work with in the following scenario:

- Copy a shared directory called "Data" from the F:\ drive to an external drive with the drive letter of G:\ drive
- Copy all subdirectories and files
- Copy all security
- Copy once at 12pm and once at 4:30pm Monday to Friday

I have the manual but need to get started asap so would like a starting point from someone who has used the tool.  
Question by:Nael_Shahid
  • 4
LVL 29

Accepted Solution

Michael Pfister earned 1500 total points
ID: 16246970
robocopy F:\ G:\ /E /COPYALL /W:1 /R:3  /LOG+:%TEMP%\Backup.log

/E will copy all files and dirs, incl. empty ones
/COPYALL will copy ALL file info (NTFS, owner, etc.)
/W:1 wait 1 second betwen retries
/R:3 retry 3 times then goto next file
/LOG+: add log info to this file

put the command into a small .CMD or .BAT file and let it start at the desired times with Windows Scheduler.

Hope it helps,


LVL 29

Expert Comment

by:Michael Pfister
ID: 16246988
Sorry, missed one info. My comand would copy ENTIRE F:\ but you wanted just to copy F:\Data! Better use:

robocopy F:\Data G:\Data /E /COPYALL /W:1 /R:3  /LOG+:%TEMP%\Backup.log
LVL 29

Expert Comment

by:Michael Pfister
ID: 16247002
and note that files that are opened with write access while robocopy runs (i.e. open Word docs) will not be copied!

Author Comment

ID: 16247140
Thanks for that.

Is there no way of copying open files?

Also, what is the switch to remove files and directories from the destination that have been removed from the source?
LVL 29

Expert Comment

by:Michael Pfister
ID: 16268057
For backup of open files add to the command line parameters


/ZB use restartable mode; if access denied use Backup mode.

I've never played with it....

To completely sync the Backup use


/PURGE delete dest files/dirs that no longer exist in source.

But I'd rather keep deleted files in my backup. If someone accidentially deletes a file and doesn't realize this before your backup script runs you can recover the file immediately from the backup drive.


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question