Environment versions
Network:
Windows 2003 Server
Hi Michel,
I use RoboCopy for things like this.
You can backup or mirror any single directory or entire tree. I often backup certain designated directories with a batch file like so...
ROBOCOPY C:\ThisFolder E:\MyPC\ThisFolder /MIR /R:5 /W:1 /NP /LOG:C:\Backup_MyPC.Log
ROBOCOPY C:\ThatFolder E:\MyPC\ThatFolder /MIR /R:5 /W:1 /NP /LOG+:C:\Backup_MyPC.Log
ROBOCOPY C:\TheOtherFolder E:\MyPC\TheOtherFolder /MIR /R:5 /W:1 /NP /LOG+:C:\Backup_MyPC.Log
Or you can also backup an entire PC like so...
ROBOCOPY C:\ E:\MyPC\C_Drive\ /MIR /R:5 /W:1 /NP /XF pagefile.sys /LOG:C:\Backup_MyPC.Log
The examples above use the mirroring switch. This copies only the files that have changed. It's also important to understand that if a file is opened, it will not be copied/mirrored. When I backup a PC that has MS SQL Server installed, I also add some lines to the batch file to stop and restart the SQL services, such as...
NET MSSQLSERVER STOP
NET SQLAGENT STOP
...
...
...
NET MSSQLSERVER START
NET SQLAGENT START
That makes sure the SQL databases are also copied.
To explain the switches I often use...
/MIR - mirror the source to the target; copy anything new; delete anything on the target that is not on the source.
/R:5 - retry any file up to 5 times if you hit an error (such as file open, etc)
/W:1 - wait 1 second between retries
/NP - no progress indicator, (such as % copied, etc)
/XF - exclude file (list any files you don't want copied/mirrored)
/LOG: - Filename (if you want a log file written)
Notice also in the first example above, how the + is used in the /LOG: switch to append to the log instead of creating a new log file with each subsequent ROBOCOPY command.
And lastly, if you have spaces in the directory structure that you're specifying, use quotes for the path names like so.
ROBOCOPY "C:\Program Files\My Important Folder" "E:\MyPC\Program Files\My Important Folder" /MIR /R:5 /W:1 /NP /LOG:C:\Backup_MyPC.Log
Hope this helps,
Guy
>I would like to obtain a tool that will help me synchronize my laptop based on a set of directories I have on my PC. Basically, it is not about copying each time the entire directory structure. I am looking for something that will only copy the updated files, the new ones and remove the ones that no longer exists. Is there such a tool somewhere? If I could have something in .NET, that would also be interesting.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only