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

08 Oct 2016   #280
chrishammond

Win7 Ult x64
 
 

Ok - I think this will work... Can you look it over and let me know
Thanks for your help guys

The source will be the NAS file mapped to a drive letter in this example T and the 2tb External USB will be U
Now I am assuming that I could add a prompt to remind him to unplug the USB

rem --- Day Zero Backup Strategy
rem --- This file MUST not be changed
rem --- The script will run every Thursday at 3.00pm exactly and results will be shown in Backup_Log.txt
echo --- Backup In Process of day zero files to external drive please wait
robocopy <t:\dayzero> <U:\dayzero> /e /np /tee /mt:4 /log:Backup_Log.txt
pause
echo --- Backup complete - Remove the USB drive and store safely. Please check Backup_log.txt for errors and notify if required
pause


My System SpecsSystem Spec
.
09 Oct 2016   #281
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Those angle brackets should not be there.

Code:
robocopy t:\dayzero U:\dayzero /e /np /tee /mt:4 /log:Backup_Log.txt
My System SpecsSystem Spec
09 Oct 2016   #282
chrishammond

Win7 Ult x64
 
 

Quote   Quote: Originally Posted by Pyprohly View Post
Those angle brackets should not be there.

Code:
robocopy t:\dayzero U:\dayzero /e /np /tee /mt:4 /log:Backup_Log.txt
Cheers, I kinda thought that but wasn't sure.. so I left them in

Question - will the message appear on the screen that is in the echo or do I have to add some more commands to make that 'pop up' to remind him to unplug the External drive?
My System SpecsSystem Spec
10 Oct 2016   #283
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Chrishammond, echo will display text on the console. If you want a popup box to happen, theres the msg command, though it’s heavily depreciated and doesn’t even work in Windows 10.

Here’s what I use for popup boxes in batch.
Code:
mshta vbscript:code(close(MsgBox("Hello World",0,"Title")))

You can get help for most commands by typing the command and following it with “/?” on the command line.
E.g.,
Code:
dir /?
My System SpecsSystem Spec
.

10 Oct 2016   #284
chrishammond

Win7 Ult x64
 
 

I wish i'd never have asked now thanks for your help
My System SpecsSystem Spec
13 Oct 2016   #285
chrishammond

Win7 Ult x64
 
 

ok... This is why i hate batch files....

Quote:
rem --- The script will fail if the external HDD is not in
robocopy z:\ u:\backup /e /np /tee /mt:4 /log:Backup_Log.txt
robocopy b:\ u:\backup /e /np /tee /mt:4 /log:Backup_Log.txt
pause
I got the script to run ONCE but it only backed up certain number of files before it seemed to stop, i say seemed to stop as it only grabbed 780mb ish and there are 34gb to grab, I tried to recreate the pattern and it now has a epic failure every time.

I'm pulling my hair out (and believe me i dont have much left)
My System SpecsSystem Spec
13 Oct 2016   #286
essenbe

Windows 7 Enterprise X64/Windows 10 Enterprise X64/Windows 10 Pro X64/Linux Mint
 
 

I looks like you are trying to backup an entire drive. Robocopy backs up folders. After Z:/ you need a folder name which will be backed up. For example

robocopy z:\data u:\backup /e /np /tee /mt:4 /log:Backup_Log.txt

That should backup a folder named Z:\data to U:\backup.
My System SpecsSystem Spec
13 Oct 2016   #287
chrishammond

Win7 Ult x64
 
 

Quote   Quote: Originally Posted by essenbe View Post
I looks like you are trying to backup an entire drive. Robocopy backs up folders. After Z:/ you need a folder name which will be backed up. For example

robocopy z:\data u:\backup /e /np /tee /mt:4 /log:Backup_Log.txt

That should backup a folder named Z:\data to U:\backup.
Ah - so with it being in multiple folders I will have to specify each path

ugh

my head hurts

or can I cheat and make one folder with multiple folders inside or will we have the same issue again?

z:\data
z:\data\crap1
z:\data\crap1\crap2\filexyz.doc

etc
My System SpecsSystem Spec
13 Oct 2016   #288
essenbe

Windows 7 Enterprise X64/Windows 10 Enterprise X64/Windows 10 Pro X64/Linux Mint
 
 

I don't know, I have never tried it, but I doubt it. But you should be able to make a batch file that will run all of them. Create a destination folder for each folder you want to backup, and try something like this

Code:
echo
robocopy z:\data u:\data_backup /e /np /tee /mt:4 /log:Backup_Log.txt&robocopy z:\crap u:\crap_backup /e /np /tee /mt:4 /log:Backup_Log.txt&robocopy z:\more_crap u:\morecrap_backup /e /np /tee /mt:4 /log:Backup_Log.txt
pause
Copy that into Notepad and name it backup.bat

Or you could organize your data you want to backup into 1 folder. Have a folder named Data, inside that folder have folders named Crap, another folder named crap1 and another named more_crap. Then you could have just 1 batch file to backup the data folder to the data_backup folder on the external drive.

I have moved all my User folders to another drive. So I have a folder named Users, inside that folder I have a folder for my user name. Inside that I have all my Libraries folders. I can also add any folder I want inside there. To do a backup i just backup my user folder to my backup folder on an external drive (3 actually). When I run the backup on the user folder, it copies the user folder and everything inside it.

I am probably not the best one to give advice on this, as I have only used Robocopy enough to do what I need to do. Maybe someone else will come along and give you better suggestions. What I do works well for me, but may not work for everyone else. This is what I use and it has worked very well for me.

Code:
echo
robocopy E:\users X:\Robocopy_W10_Data /e /mir /np /tee /mt:10 /log:backup_log.txt
pause
My System SpecsSystem Spec
14 Oct 2016   #289
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by essenbe View Post
I looks like you are trying to backup an entire drive. Robocopy backs up folders. After Z:/ you need a folder name which will be backed up.
I’d like to know the basis of your claim because there’s certainly nothing wrong with robocopy z:\ u:\backup.

However, one thing to beware of when Robocopy-ing from drives, the destination directory will be marked with the System and Hidden attributes and will need to be fixed after the backup completes. This happens because Robocopy copies the attributes of the source directory to the destination directory, and drives actually always have the System and Hidden files attributes set.


Quote   Quote: Originally Posted by chrishammond View Post
I got the script to run ONCE but it only backed up certain number of files before it seemed to stop, i say seemed to stop as it only grabbed 780mb ish and there are 34gb to grab, I tried to recreate the pattern and it now has a epic failure every time.
Could you provide specifics? Maybe elaborate on this ‘epic failure’.
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