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

22 Mar 2012   #30
JDobbsy1987

Windows 8.1 Pro x64
 
 

can you provide an example of the file paths with a description of what needs backing up and what doesnt?

e.g.
Code:
c:\projects\seven_forums\posts
c:\projects\seven_forums\threads
c:\projects\seven_forums\data
c:\projects\seven_forums\admin
c:\projects\seven_forums\stuff
i would want folders posts, threads and data backed up.

something along those lines so i can understand your requirements a little better.

Cheers


My System SpecsSystem Spec
.
23 Mar 2012   #31
rschaef07

Windows 7 Pro
 
 
Folder structure

Below is a typical folder structure:
(we have 100's of these with the difference being in the bldg# and Proj#)

R:
--Bldg# or ProjectType
----Project#1
------500_CAD
--------3D
--------A
--------C
--------D
--------E
--------G
--------M
--------S
--------Archive
--------xArchive
--------xImage
--------xInbox
--------xIssue
--------xOutbox
--------xPlot
--------xSupport
(i.e., R:\234A\60101003\500_CAD\xInbox)

The folders to be excluded are Archive, xArchive, xInbox, xSupport, xTemp

Thanks, Ron
My System SpecsSystem Spec
23 Mar 2012   #32
JDobbsy1987

Windows 8.1 Pro x64
 
 

Quote   Quote: Originally Posted by rschaef07 View Post
Below is a typical folder structure:
(we have 100's of these with the difference being in the bldg# and Proj#)

R:
--Bldg# or ProjectType
----Project#1
------500_CAD
--------3D
--------A
--------C
--------D
--------E
--------G
--------M
--------S
--------Archive
--------xArchive
--------xImage
--------xInbox
--------xIssue
--------xOutbox
--------xPlot
--------xSupport
(i.e., R:\234A\60101003\500_CAD\xInbox)

The folders to be excluded are Archive, xArchive, xInbox, xSupport, xTemp

Thanks, Ron
Try the following:
Code:
robocopy <source> <destination> /e /xd Archive xArchive xInbox xSupport xTemp
/e = include all directories including subdirectories
/xd - exclude directories <dir1> <dir2> <dir3> (this would exclude any folder with the stated names)

the other option would be to use a wildcard, for example, if you wanted to exclude all folders starting with an x then the following would also work:
Code:
robocopy <source> <destination> /e /xd x*
Hope this helps?

Regards,
JDobbsy1987
My System SpecsSystem Spec
23 Mar 2012   #33
rschaef07

Windows 7 Pro
 
 

I am already using code as you showed, including the * in the excluded folder list.
But, per an earlier post (my apologies as I thought I was still in my earlier thread), Golden replied "Robocopy treats the * as part of the name, and of course Windows does not allow a folder to contain a * in its name."

But if my excluded folders list includes "Archive", will it exclude every folder that is named "Archive"?

Thanks much, Ron
My System SpecsSystem Spec
.

23 Mar 2012   #34
JDobbsy1987

Windows 8.1 Pro x64
 
 

Quote   Quote: Originally Posted by rschaef07 View Post
an earlier post (my apologies as I thought I was still in my earlier thread), Golden replied "Robocopy treats the * as part of the name, and of course Windows does not allow a folder to contain a * in its name."
I have just tested the following script and it worked fine:
Code:
robocopy <source> <destination> /e /xd x*
It copied all folders but not any folders starting with an X

Quote:
But if my excluded folders list includes "Archive", will it exclude every folder that is named "Archive"?
Correct... unless you explicitly specified the file path/folder e.g.
Code:
robocopy <source> <destination> /e /xd "R:\234A\60101003\500_CAD\xInbox"
Do you have a lot of folders with the same name where some you would want to back up and others you wouldn't?
My System SpecsSystem Spec
25 Mar 2012   #35
Brds7t7

Windows 7 Pro 64-Bit, Windows 7 Ultimate 64-Bit, Windows 8.1 Pro 64-Bit
 
 

Hello all,

I would like to copy all the files from my T:\Data Backup drive to my D:\Data drive (I'm going to be wiping everything off D: and restoring all the files from my T: drive).

ROBOCOPY - Create Backup Script-capture-04.png

ROBOCOPY - Create Backup Script-capture-05.png

I'm wanting to copy everything, all subfolders, files, dates, times, attributes and security permissions. And using 12 threads as I am copying about 540gb of data.

Would this command do the job?

Code:
robocopy T:\ D:\ /COPY:DATSOU /MT:12 /e /np /log+:backup_log.txt
Any help would be appreciated.


My System SpecsSystem Spec
25 Mar 2012   #36
JDobbsy1987

Windows 8.1 Pro x64
 
 

Quote   Quote: Originally Posted by Burdus32 View Post
Hello all,

I would like to copy all the files from my T:\Data Backup drive to my D:\Data drive (I'm going to be wiping everything off D: and restoring all the files from my T: drive).

Attachment 204309

Attachment 204310

I'm wanting to copy everything, all subfolders, files, dates, times, attributes and security permissions. And using 12 threads as I am copying about 540gb of data.

Would this command do the job?

Code:
robocopy T:\ D:\ /COPY:DATSOU /MT:12 /e /np /log+:backup_log.txt
Any help would be appreciated.
I don't see why that wouldn't work but me personally would remove the /np so i can see the progress it is making plus i would put some retry option in just encase there was an issue accessing the destination drive during the copy:

e.g.
Code:
/Z /R:10 /W:20
this way the copy shouldn't fail but wait 20 seconds and try again (the retry enables it to carry on from where it stopped rather than starting it all over again.)

Regards,
JDobbsy1987
My System SpecsSystem Spec
25 Mar 2012   #37
Brds7t7

Windows 7 Pro 64-Bit, Windows 7 Ultimate 64-Bit, Windows 8.1 Pro 64-Bit
 
 

Thanks JDobbsy,

so would this command be ok?

Code:
robocopy <source> <destination> /E /Z /COPYALL /MT:12 /log+:backup_log.txt /R:10 /W:20
My System SpecsSystem Spec
25 Mar 2012   #38
JDobbsy1987

Windows 8.1 Pro x64
 
 

Quote   Quote: Originally Posted by Burdus32 View Post
Thanks JDobbsy,

so would this command be ok?

Code:
robocopy <source> <destination> /E /Z /COPYALL /MT:12 /log+:backup_log.txt /R:10 /W:20
That looks like it will do a good job
As a precautionary... I would always do a quick test on some MOC up folders/files

Regards,
JDobbsy1987
My System SpecsSystem Spec
25 Mar 2012   #39
Brds7t7

Windows 7 Pro 64-Bit, Windows 7 Ultimate 64-Bit, Windows 8.1 Pro 64-Bit
 
 

Brilliant, thanks for the help JDobbsy!

Just one quick question, is the
Quote:
/COPYALL
command the same as
Quote:
/COPY: DATSOU
I have an old backup drive that I use for testing, I'll try it out on that first.
My System SpecsSystem Spec
Comment

 ROBOCOPY - Create Backup Script




Tutorial Tools Search this Tutorial
Search this Tutorial:

Advanced Search




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 05:00.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App