ROBOCOPY - Create Backup Script

How to Create a Backup Script using ROBOCOPY Command


   Information
There are many paid and free software solutions available to backup critical data and files on a computer system. Many users, however, are unaware of an inbuilt Windows 7 command called ROBOCOPY (Robust File Copy) that allows users to create simple or highly advanced backup strategies.


In its simplist form, ROBOCOPY can be likened to an extension of XCOPY on steroids. Some of the more important features that make ROBOCOPY an attractive backup alternative are:
  • multi-threaded copying
  • mirroring or synchronisation mode between the destination and source
  • automatic retry and copy resumption
The examples shown below are primarily geared towards less experienced users, especially those that are unfamilar with batch file creation and running. More experienced users, however, are welcome to explore some of the advanced functionality offered by ROBOCOPY here:

http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx

and also here:

http://www.theether.net/download/Microsoft/Utilities/robocopy.pdf

or by simply typing robocopy /? at a cmd window prompt.


   Note
ROBOCOPY is a FOLDER copier, not a FILE copier - the source and destination syntax arguments in ROBOCOPY can only be folder names.


:note: Creating a BACKUP strategy

The easiest way to use the ROBOCOPY command to create a backup strategy is by creating a batch (.BAT) file. A batch file is a simple text file, that when executed, runs several commands one after the other.

Step 1

Click :orb: and in the search box, type notepad. Select Notepad to open up a new blank Notepad document.


Step 2

Type the ROBOCOPY commands into the Notepad document, save it as a .BAT file, and then execute it.

In the example below, I have 3 folders (Data1, Data2, and Data3) containing some data that I wish to backup. One folder is located on E: drive and the other two are located on F: drive. I wish to back these up as follows:

Data1 folder on E: backup to a folder called Backups on G: (external USB drive)
Data2 folder on F: backup to a folder called Backups on G: (external USB drive)
Data3 folder on F: backup to a folder called Backups on Q: (network storage drive)

The general format of the ROBOCOPY command is:

Code:
robocopy <source> <destination> <options>
In the empty Notepad document, the simplist form of the command would look like this:

Code:
robocopy E:\Data1 G:\Backups\Data1
robocopy F:\Data2 G:\Backups\Data2
robocopy F:\Data3 Q:\Backups\Data3
pause
   Tip
If source or destination paths contain spaces in them, enclose these in double quotes e.g. "C:\My Data\My Music"



Only the source
  • E:\Data1
  • F:\Data2
  • F:\Data3
and the destination
  • G:\Backups\Data1
  • G:\Backups\Data2
  • Q:\Backups\Data3
are mandatory inputs into the ROBOCOPY command.

   Tip
The PAUSE command at the bottom of the .BAT file allows the cmd window to stay open after it has completed to allow me to see the output from ROBOCOPY.


If I save the .BAT file to my Desktop, and run it by double-clicking it, then a cmd window is opened and the .BAT file executes the three ROBOCOPY commands as shown below.

R1.JPG

The same information is repeated for every ROBOCOPY line in the .BAT file.




In order to utilise some of the powerful functionality in ROBOCOPY, I need to utilise some options in the ROBOCOPY command line. In this next example I want to edit my existing backup strategy such that:
  1. All sub-folders within my data folders are backed up, even if they are empty.
  2. The backup only copies newer files to my existing backup - this means a faster backup time.
  3. The percentage progress counter for copying is not shown - this neatens the overall appearance of the ROBOCOPY information, and creates a smaller log file.
  4. The information normally echoed to the cmd window is saved to a log file that I can examine at a later stage.
In order to do this, I need to specify some additional options in my ROBOCOPY commands like this:

Code:
robocopy E:\Data1 G:\Backups\Data1 [B][COLOR=red]/e /mir /np /log:backup_log.txt[/COLOR][/B]
robocopy F:\Data2 G:\Backups\Data2 [B][COLOR=red]/e /mir /np /log+:backup_log.txt[/COLOR][/B]
robocopy F:\Data3 Q:\Backups\Data3 [B][COLOR=red]/e /mir /np /log+:backup_log.txt[/COLOR][/B]
pause
Where:
/e = copy all sub-folders, even empty ones
/mir = mirror (check the files in the destination, and only copy newer files)
/np = no progress counter
/log: = create a logfile

   Tip

Note the use of the /log+: option in the 2nd and 3rd line of the .BAT file. This option ensures that the results of the 2nd and 3rd ROBOCOPY are appended to the log file created in the 1st ROBOCOPY line, meaning I only need one log file to capture all the information I backup.

The log file is always saved to the same folder as the .BAT file - in my case, the folder is saved to my Desktop.


Since the output from ROBOCOPY is written to the log file, the cmd window will not display the output from ROBOCOPY. If I wish to have this information written to both the log file and the cmd window for visual tracking of the backup process, then I can add the /tee option to each line in the .BAT file, as shown below.

Code:
robocopy E:\Data1 G:\Backups\Data1 /e /mir /np [B][COLOR=red]/te[/COLOR][COLOR=red]e[/COLOR][/B] /log:backup_log.txt
robocopy F:\Data2 G:\Backups\Data2 /e /mir /np [COLOR=red][B]/tee[/B][/COLOR] /log+:backup_log.txt
robocopy F:\Data3 Q:\Backups\Data3 /e /mir /np[COLOR=red][B] /tee[/B][/COLOR] /log+:backup_log.txt
pause
This is an example of the typical output to the the log file - it looks exactly the same as what is echoed to the cmd window.

Code:
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------
  Started : Sun Sep 18 23:35:01 2011
   Source : E:\Data1\
     Dest : G:\Backups\Data1\
    Files : *.*
 
  Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30 
------------------------------------------------------------------------------
                    2 E:\Data1\
------------------------------------------------------------------------------
               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         2         0         2         0         0         0
   Bytes :   442.1 k         0   442.1 k         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00
   Ended : Sun Sep 18 23:35:01 2011
Since one of the data folders I am backing up is being copied across a network, I want to ensure that any possible network outages do not cause some critical files to be skipped in the backup. To do this, I can make use of the /z option in the 3rd line of my .BAT file (backup to my network storage) as shown below.

Code:
robocopy E:\Data1 G:\Backups\Data1 /e /mir /np /tee /log:backup_log.txt
robocopy F:\Data2 G:\Backups\Data2 /e /mir /np /tee /log+:backup_log.txt
robocopy F:\Data3 Q:\Backups\Data3 /e /mir /np [B][COLOR=red]/z[/COLOR][/B] /tee /log+:backup_log.txt
This option implements a "retry" for the copying. If I were part way through the copying process, and I lost connection with the network, then ROBOCOPY would automatically restart the copying at the point of failure once the network connection was re-established. It would retrying a million times every 30 seconds (the default settings shown in the image above). The only drawback with this option, is that it can significantly increase the backup time.

ROBOCOPY also has the ability to perform faster multi-threaded copying by simply using the option /mt. I can choose the number of threads to use by specifying a number between 1 and 128 after the /mt option, or if I just specify /mt without a number then the it will use 8 threads by default. In the example below, I use 4 threads to copy to my USB drive, and 8 threads (no number) to copy to my network drive.

Code:
robocopy E:\Data1 G:\Backups\Data1 /e /mir /np /tee [B][COLOR=red]/mt:4[/COLOR][/B] /log:backup_log.txt
robocopy F:\Data2 G:\Backups\Data2 /e /mir /np /tee [COLOR=red][B]/mt:4[/B][/COLOR] /log+:backup_log.txt
robocopy F:\Data3 Q:\Backups\Data3 /e /mir /np [COLOR=black]/z[/COLOR] /tee [COLOR=red][B]/mt[/B][/COLOR] /log+:backup_log.txt
Below is a template that you can use to create your own backup strategy using ROBOCOPY. Simply copy and paste the lines into a blank text document, and then edit as appropriate.

Code:
rem --- Edit the lines below to create your own backup strategy
rem --- The /mir option has been left out for safety sake
rem --- Add more lines for each new folder requiring backup
rem --- Specified 4 threads to use for multi-threaded copying
rem --- The results of the backup can be found in my_backup_log.txt 
robocopy <source> <destination> /e /np /tee /mt:4 /log:my_backup_log.txt
robocopy <source> <destination> /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy <source> <destination> /e /np /tee /mt:4 /log+:my_backup_log.txt
pause
   Tip

The can automate your backup's by using the Windows 7 Task Scheduler to run the .BAT file at specific times.

For more information please refer to this tutorial by Orbital Shark:
http://www.sevenforums.com/tutorials/12444-task-scheduler-create-new-task.html


I hope this brief tutorial helps you access the power and simplicity of ROBOCOPY to create some effective backup strategies.

Regards,
Golden
 
Last edited by a moderator:
Bravo! Well done, Golden!
 

My Computer

Computer Manufacturer/Model Number
Too many to describe...
OS
Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
Thanks Bill :cool:
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518

My Computer

Computer Manufacturer/Model Number
home-built
OS
Win 7-32, XP Pro-32
CPU
Xeon 3070 (2.66 GHz)
Motherboard
Asus P5W DH Deluxe, BIOS 2901
Memory
4 GB
Graphics Card(s)
PowerColor ATI Radeon HD 5750 (fanless)
Sound Card
on-board
Monitor(s) Displays
Dell U2711
Screen Resolution
2560x1440
Hard Drives
All SATA:
ICH7R (AHCI): 1 Intel X-25M 80GB SSD, 2 Samsung HD103UJ 1TB, 1 Seagate ST3750330MS 750GB;
JMB363: Samsung SH-S223L DVD;
Promise TX4302: two mobile racks, normally powered off
PSU
Seasonic SS-650HT
Case
Antec P180
Cooling
Sunbeam Tuniq Tower 120, 4 120mm fans (variable rpm)
Keyboard
Lexmark IBM Type "M" - PS/2 connector
Mouse
Wacom Intous4, Logitech Wheel Mouse as backup
Internet Speed
Cable ~ 6 mbps
Other Info
DVD: Samsung SH-S223L (SATA),
SanDisk CompactFlash reader,
Epson R280 printer,
HP Laserjet 4100dtn,
Epson scanner,
NeatReceipts scanner

Laptops: Dell XPS 15 L501x, Dell E5420
Thanks Guy. I've been having some formatting "issues" with http's recently - links corrected.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
winscp also provides handy automated backups

Came across this forum while looking for alternative backup strategies. I've found Dropbox and Mozy quite useful, but also winscp (with a bit of work). The first two do continuous backup but winscp is ideal if you want an in-house solution.
 

My Computer

OS
Windows 7 Home Premium
Brilliant tutorial thanks!
 

My Computer

Computer Manufacturer/Model Number
ASUS G53JW
OS
Windows 7 Ultimate x64
CPU
Intel Core i7 Q740
Memory
8GB
Graphics Card(s)
nvidia GeForce GTX460m
Screen Resolution
1900x1080
Hard Drives
OCZ Vertex 2
Mouse
Razer Abyssus
Internet Speed
Too slow
Brilliant tutorial thanks!

Thanks BigV. Many of our MVP's that attend conferences can testify that SevenForums has by far the best tutorials out there.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Very Nice , But a person like me who is very new at this computer stuff how can i restore my files from this operation ?? and where can i see them ???
 

My Computer

OS
Windows 7 64bit
Hi Mick,

Thanks for the comment. ROBOCOPY is designed to backup/copy folders to another destination (different disk, external USB drive). The idea is that if the original files are accidently deleted or damaged, you can simply copy the required from the backup location to where you need them.

If you need help setting up a robocopy script to backup your data, then let me know and I'll write one for you.

Regards,
Golden
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Hi Mick,

Thanks for the comment. ROBOCOPY is designed to backup/copy folders to another destination (different disk, external USB drive). The idea is that if the original files are accidently deleted or damaged, you can simply copy the required from the backup location to where you need them.

If you need help setting up a robocopy script to backup your data, then let me know and I'll write one for you.

Regards,
Golden

Yes Please, this would be amazing if u can help me on this, will be waiting
 

My Computer

OS
Windows 7 64bit
Hi,

OK. You need to let me know what you want backing up, and to where.

The easiest way is to show me some screen capture images of:

1. Your Disk Management with your USB external drive plugged in (so I can see the arrangement of your disks)
2. Windows Explorer showing me the paths and files you want to backup.

See here for help on getting me the information:

http://www.sevenforums.com/tutorials/9733-screenshots-files-upload-post-seven-forums.html

Regards,
Golden
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Robocopy: trouble skipping files with "/XF"

Should the below description and robocopy script work?

I have robocopy backup scripts that just don't do what I want them to. Because I have limited exernal storage, I'm trying to exclude certain directories and file types, using /XD & /XF.
In ROBO #1 I want to mirror (/MIR) the source to the target, but exclude filetypes PDF, JPG & ZIP. I tried using "/XF *.jpg", but it didn't work with the period (.), so I removed it, but it still didn't work. I also want to exclude a variety of directoreis using /XD.
In ROBO #2, I want to back up only the jpg, pdf & zip files (& only if they are not older than 14 days), into the same folders as ROBO #1, only without the /MIR option.

ROBO #1
robocopy R:\ "E:\R.Drive\1.Tuesday" /XF *.jpg *.pdf *.zip /XD ArcJet3DSurvey xArchive Archive Inbox Temp "xSubmission Archives" "_Site Director's Shared Docs" "Nebula Modular Data Center" "*60040107 (K80017)_REDS - General" "*60046720 (K80044)_REDS8 - Repackaging" "*60176753 (K10018)_REDS - High Voltage" "*60177138 (K10033)_REDS8 Alstom Relays" "*REDS_As-Built Drawings" /MIR

ROBO #2
robocopy *jpg *pdf *zip R:\ "E:\R.Drive\1.Tuesday" /MAXAGE:14 /E

Thanks for your assistance,
Ron
 

My Computer

Computer Manufacturer/Model Number
Dell Precision workstation T3500
OS
Windows 7 Pro
CPU
Xeon
Graphics Card(s)
NVidia 512mb
Hi Ron, and welcome to SevenForums,

Lets start with ROBO #2. The command should look like this:

Code:
robocopy R:\ *.jpg *.pdf *.zip E:\R.Drive\1.Tuesday /MAXAGE:14 /E

With ROBO #1, the major issue is the the use of * in the folder name (for example *60176753 (K10018)_REDS - High Voltage). Robocopy treats the * as part of the name, and of course Windows does not allow a folder to contain a * in its name. You will need to specify the top-level folder that contains all these sub-folders in the robocopy script.

However, you can still do this part:

Code:
robocopy R:\ E:\R.Drive\1.Tuesday /E /MIR /XF *.jpg *.pdf *. zip /XD ArcJet3DSurvey xArchive Archive Inbox Temp xSubmission Archives _Site Director's Shared Docs Nebula Modular Data Center

If you paste an image of the folder structure containing the REDS folders, it would help me work out a way to sort out these folders for backup.

Here is a little batch file that you can use to run ROBO #1 and ROBO #2. Simply copy the text exactly as it is, and paste it into an empty Notepad file, and save it on your desktop as RUN.BAT:

Code:
echo off
color 1E
cls
:MENU
echo.
echo ******************************
echo *** Robocopy Backup Script ***
echo ******************************
echo.
echo 1 - Run ROBO #1
echo 2 - Run ROBO #2
echo 3 - Exit
echo.
echo ******************************
echo.
SET /P M=Type 1, 2 or 3 then press ENTER:
IF %M%==1 GOTO 1
IF %M%==2 GOTO 2
IF %M%==3 GOTO 3
:1
robocopy R:\ *.jpg *.pdf *.zip E:\R.Drive\1.Tuesday /MAXAGE:14 /E
goto MENU
:2
R:\ E:\R.Drive\1.Tuesday /E /MIR /XF *.jpg *.pdf *. zip /XD ArcJet3DSurvey xArchive Archive Inbox Temp xSubmission Archives _Site Director's Shared Docs 
Nebula Modular Data Center
goto MENU
:3
pause
exit
The image below shows what it will look like when you run it. If you want something similar, or even simpler, just let me know.

Post back here if you need more help.

Regards,
Golden
 

Attachments

  • Capture.JPG
    Capture.JPG
    47.2 KB · Views: 1,416

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
I have been trying to write a batch file so that I can copy two folders to a separate drive, and failed dismally, I then found:

Golden wrote:
If you need help setting up a robocopy script to backup your data, then let me know and I'll write one for you.
And hope my prayers have been answered, 'cos I am probably way out of my depth with this one!!

Having very nearly lost my email folder a while ago I would like to make exact hard copy of it, not compressed or by using a 'Backup Program' (that corrupts the files:cry:)

I have an Outlook 2010 email folder;

C:\users\alanspc\My Documents\Outlook Files\ 'My email address' shown as an 'Outlook Data File' not a .pst file

I wish to copy this to my internal F:\ drive which I use only for backups. This drive is a separate HD.

Maybe it would be better to copy the whole 'Outlook Files\' in above?

I would also like to be able to only add any changes to the file that have been made like new emails which would save time, Is this called incremental backups?:confused: Whether this can be/should be done on opening or closing Outlook, or done 'as and when' manually I am not sure.

Once I have a basic idea of what I am doing I can hopefully build on it in the future. I can then copy and change the batch file to copy other folders onto my F:\ drive...

At least having something that works at the start would be a great advantage over my failures so far!
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home Build
OS
Windows 7 Professional 64bit
CPU
i5-2500K 3.30Hz 6MB Cache
Motherboard
ASUS P8P67 Pro B3 Revision
Memory
16GB DDR3
Graphics Card(s)
ASUSGeforce GTX1050Ti 4GB
Sound Card
On-Board
Monitor(s) Displays
LG23MP65HQ-P
Hard Drives
WD Caviar Green 500gb
Maxtor 300gb
WD External USB 120gb
WD My Passport USB 2TB
LUX3 External USB 1TB
PSU
Corsair 800W
Case
Antec
Cooling
Arctic 13 Cooler
Antivirus
Bitdefender Total Security 2017
Browser
FireFox
Nice Tut!

Here is a quick robocopy batch file i put together a while back, you would just have to change the actual robocopy command on line 77 to reflect the switches you would like.

The reason there is so many lines for such a simple command is because i padded it out visually a little for the people using it :)

Source.PNG Destination.PNG Warning.PNG
 

Attachments

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 8.1 Pro x64
CPU
Intel Core i5-2500K @ 3.30GHz - S1155
Motherboard
Asus P8P67 LE Rev3, Intel P67, S115
Memory
8GB Corsair DDR3 XMS3, PC3-12800
Graphics Card(s)
NVIDIA GeForce GTX 650
Sound Card
On-Board
Monitor(s) Displays
3 x 24" {Extended Display}
Screen Resolution
1920 x 1080
Hard Drives
300GB Seagate Barracuda 7200
PSU
550W Coolermaster GX550
Case
Silverstone Precision PS04B
Cooling
Stock
Keyboard
Logitech K120
Mouse
World of Warcraft Cataclysm MMO Gaming Mouse
Internet Speed
80 MB
Antivirus
MSE / Windows Defender
Browser
Chrome
Hi Thanks for the reply, I have been playing with the example given in the tutorial and have tried without success to copy a test file.

This is my modified Robocopy text in Notepad:

rem --- Edit the lines below to create your own backup strategy
rem --- The /mir option has been left out for safety sake
rem --- Add more lines for each new folder requiring backup
rem --- Specified 4 threads to use for multi-threaded copying
rem --- The results of the backup can be found in my_backup_log.txt
robocopy <C:\Users\Alans PC\TEST FOLDER> <F:\Outlook Data Files> /e /np /tee /mt:4 /log:my_backup_log.txt
robocopy <source> <destination> /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy <source> <destination> /e /np /tee /mt:4 /log+:my_backup_log.txt
pause

My modified text in BOLD
This has not worked and the TEST FOLDER has not been copied to F:\Outlook Data Files, after double clicking the command on my desktop it flashes on screen for a millisecond as though it actions.

I have called my F:\ drive 'Backup (F)' according to Disk Management, would that have any bearing on my problem?
Do I need to delete the 2nd and 3rd robocopy lines?

Does the destination drive have to have the same folder name as the folder to copy? For example in the tutorial the example states:

robocopy E:\Data1 G:\Backups\Data1
robocopy F:\Data2 G:\Backups\Data2
robocopy F:\Data3 Q:\Backups\Data3
pause

Using the above do I need to name a folder in G: Backups with a sub folder called Data1?

So in Backups folder I would have a sub folder called Data1 containing the copied folder Data1. OR would the Data1 folder be copied to Backups? Thereby becoming the sub folder.....

If you see what I mean!!



I've yet to play much with DOS boxes and doing this in notepad seems more 'usual' I just need to get to grips with it.

EDIT.
I have tried with the <> removed and still not copied, I must have something fundamentally wrong. (Like my brain)
 
Last edited:

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home Build
OS
Windows 7 Professional 64bit
CPU
i5-2500K 3.30Hz 6MB Cache
Motherboard
ASUS P8P67 Pro B3 Revision
Memory
16GB DDR3
Graphics Card(s)
ASUSGeforce GTX1050Ti 4GB
Sound Card
On-Board
Monitor(s) Displays
LG23MP65HQ-P
Hard Drives
WD Caviar Green 500gb
Maxtor 300gb
WD External USB 120gb
WD My Passport USB 2TB
LUX3 External USB 1TB
PSU
Corsair 800W
Case
Antec
Cooling
Arctic 13 Cooler
Antivirus
Bitdefender Total Security 2017
Browser
FireFox
try putting quotes around the file paths

e.g.
Code:
robocopy "C:\Users\Alans PC\TEST FOLDER" "F:\Outlook Data Files" /e /np /tee /mt:4 /log:my_backup_log.txt

Regards,
JDobbsy1987
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 8.1 Pro x64
CPU
Intel Core i5-2500K @ 3.30GHz - S1155
Motherboard
Asus P8P67 LE Rev3, Intel P67, S115
Memory
8GB Corsair DDR3 XMS3, PC3-12800
Graphics Card(s)
NVIDIA GeForce GTX 650
Sound Card
On-Board
Monitor(s) Displays
3 x 24" {Extended Display}
Screen Resolution
1920 x 1080
Hard Drives
300GB Seagate Barracuda 7200
PSU
550W Coolermaster GX550
Case
Silverstone Precision PS04B
Cooling
Stock
Keyboard
Logitech K120
Mouse
World of Warcraft Cataclysm MMO Gaming Mouse
Internet Speed
80 MB
Antivirus
MSE / Windows Defender
Browser
Chrome
Do I need to delete the 2nd and 3rd robocopy lines?

Yes, just keep:

robocopy "C:\Users\Alans PC\TEST FOLDER" "F:\Outlook Data Files" /e /np /tee /mt:4 /log:my_backup_log.txt

they are just to highlight the syntax that should be used
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 8.1 Pro x64
CPU
Intel Core i5-2500K @ 3.30GHz - S1155
Motherboard
Asus P8P67 LE Rev3, Intel P67, S115
Memory
8GB Corsair DDR3 XMS3, PC3-12800
Graphics Card(s)
NVIDIA GeForce GTX 650
Sound Card
On-Board
Monitor(s) Displays
3 x 24" {Extended Display}
Screen Resolution
1920 x 1080
Hard Drives
300GB Seagate Barracuda 7200
PSU
550W Coolermaster GX550
Case
Silverstone Precision PS04B
Cooling
Stock
Keyboard
Logitech K120
Mouse
World of Warcraft Cataclysm MMO Gaming Mouse
Internet Speed
80 MB
Antivirus
MSE / Windows Defender
Browser
Chrome
Hi Trapper,

Unfortunately, ROBOCOPY doesn't have the ability to copy incremental portions of your Outlook file - the smallest level it will work at is the .PST file.

This is the exact command I use to backup my Outlook data files:

Code:
robocopy E:\Mail G:\Colin-PC\Mail /e /mir /mt:12
Note that I don't specify the .PST files - ROBOCOPY just backups up the entire \Mail folder (the \Mail folder actually has two .PST files in it).

If you use the pause command at the end of the script, the cmd window will not flsh and close as you describe. So, for example, you might use this:

Code:
robocopy C:\Users\Alans PC\TEST FOLDER F:\Outlook Data Files /e /np /tee /mt:4 /log:my_backup_log.txt
pause
Also, if you scan the contents of my_backup.log (located on your Desktop), it might yield some cluse as to where you are going wayward with your script. Attach it here, and I'll take a look at it for you.

Regards,
Golden
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Back
Top