Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: ROBOCOPY - Create Backup Script

18 Sep 2011   #139
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 
ROBOCOPY - Create Backup Script

How to Create a Backup Script using ROBOCOPY Command


...


My System SpecsSystem Spec
28 Oct 2012   #140
ramyad

Win 7 x64
 
 
How to use ROBOCOPY AFTER manually backing up

Hello,

Great thread on robocopy.

I have a NAS and manually copied over the files. I now want to use robocopy.

I am wary of using robocopy as my backup tool as I have some thoughts which may cause issues:

1) The datetime on the folders and files on the NAS are when I did the manual copy, not the source attributes, and so if I use the robocopy /MIR I am not sure what will happen.

How should I sync the NAS folder/files attributes back to the source with robocopy so I can use /MIR successfully?

Basically asking what should be the steps if a person used to copy folders manually and NOW wants to use robocopy? You guide seems to be for first time use and some points on how to transition from a manual process would be great.

2) Also, I have a number of source folders from many machines which I copy to ONE folder on the NAS. That is, all sub folders from multiple sources go to ONE folder on the NAS, which essentially is all the source sub folders under one folder on the NAS.

I want to be able to mirror the source locations to a "merged" single destination folder and only copy over changes.

Is that possible with robocopy?

Thanks!


My System SpecsSystem Spec
28 Oct 2012   #141
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

Hi,

I'm not sure what would happen transitioning from manual copy to robocopy - all I can suggest is to setup a simple test case and experiment with that.

For the merged location, you can do that. This is what I have:

Code:
robocopy E:\Music G:\General_Backup\Music /e /mir /mt:8 /R:3 /W:3
robocopy E:\Photo's G:\General_Backup\Photo's /e /mir /mt:8 /R:3 /W:3
robocopy F:\Keys G:\General_Backup\Keys /e /mir /mt:8 /R:3 /W:3
Again, its best to put a small test case together and check how it works.

Regards,
Golden
My System SpecsSystem Spec
04 Nov 2012   #142
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 
/MIR is perfectly safe, does not delete files from source

Quote   Quote: Originally Posted by Golden View Post
Warning
Use the /MIR option with caution - it has the ability to delete a file from both the source and destination under certain conditions.

This typically occurs if a file/folder in the destination has been deleted, causing ROBOCOPY to mirror the source to the destination. The result is that the same files in the source folder are also deleted. To avoid this situation, never delete any files/folders from the destination - delete them from the source, and then run the backup to mirror the destination to the source.

If in doubt, do not use the /MIR option, but be aware that backups will take longer.
For benefit of anyone following this tutorial: this section is incorrect. I checked with knowledgeable MS sources, and I and others tested this extensively.

/MIR is perfectly safe to use. /MIR does not delete files from source, ever. Even if you manually delete files from destination, /MIR will not delete files from source.

In fact, the only time Robocopy deletes files from source is if you use the /MOV option to move files, (which deletes from source after copying).

Please correct this otherwise good tutorial to remove the false warning about the useful /MIR option.
My System SpecsSystem Spec
04 Nov 2012   #143
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

If you type robocopy /? at a command prompt you will see that:

/mir is the same as performing /purge and /e

Have a look at what the /purge option does.
My System SpecsSystem Spec
.


04 Nov 2012   #144
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 

I'm well aware that /MIR = /PURGE + /E. That will never delete files from source.

Quote   Quote: Originally Posted by Microsoft Technet
/PURGE : Deletes destination files and directories that no longer exist in the source.
That means that Robocopy will delete files from destination, if you have deleted them from source.

Neither /PURGE nor /MIR will delete files from source. Please test it, you'll see.
My System SpecsSystem Spec
04 Nov 2012   #145
Parman

Windows 7 Ultimate x64
 
 

Great write up robocopy is pretty powerful.
My System SpecsSystem Spec
07 Nov 2012   #146
Kornjace

Windows 7 professional 64-bit
 
 

First, congrats and thanks for the good article!
Now letís get to my problem.
I tried to set up a back up strategy. When I tried the syntax directly in CMD there is no problem, and the files are copied properly. But when I try to set up a .bat file, the program does not run (it starts, but it does not finish, nor initialize). The file is located on my desktop.
Iíve attached a picture of cmd when I start the robo.bat file.

Here is the syntax:
robocopy d:\diploma d:\programi\dropbox\diploma /s /np /tee /log:d:\diploma\robo.txt
pause

What am I doing wrong?

Thanks


Attached Thumbnails
ROBOCOPY - Create Backup Script-robocopy.jpg  
My System SpecsSystem Spec
07 Nov 2012   #147
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 

Try running the .bat as Administrator (a right-click command).
My System SpecsSystem Spec
07 Nov 2012   #148
Kornjace

Windows 7 professional 64-bit
 
 

Already tried, same resultÖ
My System SpecsSystem Spec
07 Nov 2012   #149
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 

Are you able to run other .bat files from that location? (e.g. .bat files that aren't running Robocopy?)
My System SpecsSystem Spec
Comment

 ROBOCOPY - Create Backup Script




Tutorial Tools



Similar help and support threads for2: ROBOCOPY - Create Backup Script
Windows 7 Tutorial Category
Robocopy Backup - ERROR 5 (0x00000005) Backup and Restore
How to create batch script to lock workstation then log off. General Discussion
Robocopy backup for personal folders Backup and Restore
I Need Help To Create REG. Script With Admin. Priv. For Reg. Editor? Customization
Robocopy backup - file permissions General Discussion
Anyone use robocopy to backup? Backup and Restore
Create ErrorHandler.cmd script file General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 09:55 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33