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

30 Dec 2012   #190
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by kqo View Post
Thank you for all your replies.
@Golden My Appdata folder is just 4.62GB. I will try it without the /z option and reply
@acornada I thought the /e option meant Robocopy should copy all subdirectories and even empty ones.
@Kaktussoft can you explain a bit better about the /XJ switch as this is the explain from the link you posted"/XJ :: eXclude Junction points. (normally included by default)."

Thank you guys
It simply excludes junction points.

In command prompt goto %userprofile%\AppData\Local

Code:
c:
cd  %userprofile\Appdata\Local
now look what is in it
Code:
dir
Now look what is in subfolder dir "Application Data"

Code:
dir "Application Data"
Do you see it's the same? So dir "Application Data" points to same folder.
So %userprofile\Appdata\Local\"Application Data" is %userprofile\Appdata\Local
So %userprofile\Appdata\Local\"Application Data"\"Application Data"\"Application Data"\"Application Data"\"Application Data"\"Application Data" is %userprofile\Appdata\Local

It is backupping things maybe 10 times until filename is too long.


My System SpecsSystem Spec
30 Dec 2012   #191
kqo

Windows 7 Professional x64
 
 

Quote   Quote: Originally Posted by Kaktussoft View Post
Quote   Quote: Originally Posted by kqo View Post
Thank you for all your replies.
@Golden My Appdata folder is just 4.62GB. I will try it without the /z option and reply
@acornada I thought the /e option meant Robocopy should copy all subdirectories and even empty ones.
@Kaktussoft can you explain a bit better about the /XJ switch as this is the explain from the link you posted"/XJ :: eXclude Junction points. (normally included by default)."

Thank you guys
It simply excludes junction points.

In command prompt goto %userprofile%\AppData\Local

Code:
c:
cd  %userprofile\Appdata\Local
now look what is in it
Code:
dir
Now look what is in subfolder dir "Application Data"

Code:
dir "Application Data"
Do you see it's the same? So dir "Application Data" points to same folder.
So %userprofile\Appdata\Local\"Application Data" is %userprofile\Appdata\Local
So %userprofile\Appdata\Local\"Application Data"\"Application Data"\"Application Data"\"Application Data"\"Application Data"\"Application Data" is %userprofile\Appdata\Local

It is backupping things maybe 10 times until filename is too long.
Thank you very much @Kaktusofft the explanation you gave above was exactly the problem. I noticed initially that when i ran the script without the /XJ switch it would get to a stage and start backing up Appdata\Local\Application Data\Application Data and the same path is repeated just as you explained.
My script worked fine after using the /XJ switch and 1 hour 20 mins later my backup was done to the server.
@Golden thank you for creating this thread i am grateful.
My System SpecsSystem Spec
14 Jan 2013   #192
carrzkiss

Windows 7 Ent. (32)
 
 

How is everyone doing?
OK, this is my situation.

I have never had an issue using Robocopy on XP or Win2k3 Server.
However, with Windows 7, it is a complete nightmare.

OK

Running a simple script like this:

@robocopy "M:" "K:/Archive Files"

I receive the following error, of which I had to record the screen to view the error message.

Quote:
Source: M:\" K:\Archive\
Dest: K:\Files
Files: *.*
Options......
-------------------
2013/01/14 13:19:03 Error 123 (0x0000007B) Accessing Source Directory M:\"K:\Archive\
The filename, directory name, or volume label syntex in incorrect.
So, my question is this.
How do you use the new Win7 Robocopy?
I need to wrap my folders with spaces in them, and this is causing me some major headache.

I did a complete backup of over 200GB's last night, and woke up this morning, to:
1 drive completed successfully
1 drive, missed 1/2 of its files.
3 Drives, copied only the folder names, but no files over.

The code I used for that, was something like this, for the folders.

@robocopy M: K:/Archive Files
@robocopy M: K:/DriveB
@robocopy M: K:/Drive A

As you can tell, the only one that copied over completely was the /DriveB

Any help on this issue, will be mighty grateful
Carrzkiss
My System SpecsSystem Spec
14 Jan 2013   #193
Jeckler

Windows 7 Enterprise x64
 
 

I don't think the quotes are necessary for the source and use \ instead of / for the target. You may need to exclude some folders too (/XD), as robocopy might try and copy your Recycle Bin, hidden as RECYCLER in the root of M:.
/E might be needed, especially if some of the folders are empty and you want them copied anyway.
My System SpecsSystem Spec
14 Jan 2013   #194
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64
 
 

Hi,

Run the .bat file as Administrator (right-click it and click 'Run as administrator')

Try this in your script:

Code:
robocopy M:\ K:\ArchiveFiles /e /copyall
robocopy M:\ K:\DriveB /e /copyall
robocopy M:\ K:\DriveA /e /copyall
Regards,
Golden
My System SpecsSystem Spec
14 Jan 2013   #195
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 

Don't add the trailing slash when copying root of a drive.

Exclude "$RECYCLE.BIN" "System Volume Information", as you likely don't want them backed up. Other options may also be useful, if you told us what you wanted.

Right-click your .bat file and select "Run as Administrator".

Below are the commands to use for what you've so far said you want (note discrepancy in naming between "DriveB" and "Drive A", and decide if you intended it).

ROBOCOPY "M:" "K:\Archive Files" /COPYALL /MIR /XD "$RECYCLE.BIN" "System Volume Information" /XF DESKTOP.INI

ROBOCOPY "M:" "K:\DriveB" /COPYALL /MIR /XD "$RECYCLE.BIN" "System Volume Information" /XF DESKTOP.INI

ROBOCOPY "M:" "K:\Drive A" /COPYALL /MIR /XD "$RECYCLE.BIN" "System Volume Information" /XF DESKTOP.INI
My System SpecsSystem Spec
15 Jan 2013   #196
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Add swich /XJ as well!
My System SpecsSystem Spec
15 Jan 2013   #197
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 

Quote   Quote: Originally Posted by Kaktussoft View Post
Add swich /XJ as well!
Yes, I would, and I would add other options. But the poster hasn't told us what he wants, so it's hard to know what options are appropriate.
My System SpecsSystem Spec
19 Jan 2013   #198
ROBO731

Windows 7 Home Premium x64
 
 

Would this work If it was backing up files that were currently open and being used? For example I want to use it to backup a minecraft server. Would I need to stop the server and then back it up or could I just do it while it's on and I'm playing?
My System SpecsSystem Spec
19 Jan 2013   #199
acornada

Windows 7 Home Premium SP-1, 64-bit
 
 

Some types of files don't copy properly when in use. You may want to check some Robocopy resources on the www for more information.
My System SpecsSystem Spec
Comment

 ROBOCOPY - Create Backup Script




Tutorial Tools





Similar help and support threads
Windows 7 Tutorial Category
robocopy script is not working through Scheduler
Dear All, My batch file of robocopy is working fine. But when I tried to run it through task scheduler, none of the files transfer to the target location. @echo off echo +-----------------------------------------+ echo Database Export Utility for server ...
General Discussion
Robocopy Backup - ERROR 5 (0x00000005)
Hi, I'm wondering if anyone might be able to shed some light on why I am getting the following such errors when running a robocopy batch file (as administrator) which cause the backup script to stall (- albeit temporarily): I am using the following backup command: robocopy "%srcPath%\My...
Backup and Restore
How 2 create a script/BAT or something that changes my desktop image?
Okay so I just got this program called Transparent Screen Lock and you can run files when the program starts/locks and closes/unlocks. What I would like to do is create a script or something that changes my desktop background to an image when I click "lock" and another script to change the desktop...
Customization
Robocopy backup for personal folders
I have created a batch file for copying my Documents folder to an external hard drive: The log file shows that it is backing up C:\users\USERNAME\documents\My Music and C:\users\USERNAME\documents\My Pictures. That's fine, because I want those backed up anyway, but when I go to...
Backup and Restore
I Need Help To Create REG. Script With Admin. Priv. For Reg. Editor?
Hello. I have a technical question/issue I wish to ask. I hope someone can help me. I am looking help for someone to modify or rewrite for me a simple system registry script for my context menu that allows or forces to "run as administrator" privileges automatically when I click on the...
Customization
Anyone use robocopy to backup?
Evening all, Just curious to know if anyone uses the built in utility to backup software on your machine, im trying to backup my itunes folder to an external HD but having a few issues to get this to work properly! I also use sync toy for backing up but just really want to know what everyone...
Backup and Restore

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 08:12.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App