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:
I don't know what you mean about having Robocopy copy a linked folder. Robocopy won't traverse an HTML URL to copy a folder; you must enter the location of the folder you want Robocopy to copy.

Show your Robocopy code.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell XPS 15 L502X
OS
Windows 10 Home, 64-bit
Hi
Thanks for the reply.
I will explain what i want to do ..

I have a saved HTM file in my source folder and i want to use a batch file to copy this file to destination folder. When the HTM file is saved there will be folder created automatically. Now when i manually copy either the HTM file or the folder, the other one get copied automatically.

Same way i want to use batch file and copy the HTM file (the user will provide the file name to be copied). requirement is that the associated folder should also be copied along with the HTM file.

When i use COPY / XCOPY command , only the HTM files is getting copied.

i used this code where %1 will be the file name i want to copy
xCOPY %1 "C:\dst\"
 
Last edited:

My Computer

Computer Manufacturer/Model Number
Dell Latitude
OS
Win7 32 Bit
COPY and XCOPY are not Robocopy commands. COPY and XCOPY are each separate applications, so you haven't been using Robocopy at all.

IIRC, Copy and Xcopy are essentially file copy utilities, so at their most basic would copy selected files whereas you also want to copy directories.

Robocopy will do what you want, because Robocopy is natively a folder copy application rather than file copy, so copying a folder by default includes its file contents.

You would use this format:

ROBOCOPY "source" "destination" options

For example, if your source folder is:

C:\web files

and your destination is:

C:\Backups\web backup

You could use this command line:

ROBOCOPY "C:\web files" "C:\Backups\web backup" /MIR

/MIR will MIRror a directory tree, including all sub-folders and including empty sub-folders, and of course including file contents of the source folder(s). You can add other options as required.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell XPS 15 L502X
OS
Windows 10 Home, 64-bit
robocopy over a LAN

Can you use this over a LAN connection?
I need to copy SQL .bak files from a server, using 2008 R2, to another server, also using 2008 R2 over a LAN.
Each system is on a different ip scheme and using vlans.

With this, how could this work?
I need to run this automatically every month.

I am not experienced in this, so ANY information would be grateful!

I did find the beginning tutorial very informational!!!

Thanks

Mike
 

My Computer

OS
Server 2008 R2 and windows 7 64-bit
is this correct?

ok...

here is what I wrote but havent implemented it yet

Does it look correct?

::Source path
set sourcepath=\\10.107.145.12\"c:\program files\microsoft sql server\mssql10_50.mssqlserver\mssql\*.bak"

:destination path
set destinationpath=\\10.107.128.11\E$\"backup sql files"

::Log path
set logpath=E:\Logs\Robocopy\

::Include format yyyy-mm-dd#hh-mm-ss.ms in log filename
set filename=Robocopy_%date:~-4,4%-%date:~-7,2%-%date:~-10,2%#%time::=-%.txt

::Run command
 

My Computer

OS
Server 2008 R2 and windows 7 64-bit
Hey Guys

I need help with a backup script to do backups on my laptop running Win7 Pro x64 to my Win2008R2 server.
Here is the script i wrote
@echo off
TITLE Backup program

echo Please save any open documents and then close all programs, especially Outlook.
echo off
pause

cls
net use R: /delete
goto begin

:begin
net use R: \\surulere\backup /USER:conet.com\koladapo Kq14lakoil
robocopy C:\Users\Kola R:\Kola /e /z /R:5 /W:1

echo.
echo The backup has finished.

goto done

:done
pause
if exist R: net use R: /d /y
exit


I am sorry i did not put comments to explain the script better. but the summary of what i did is
1. i delete any drives mapped to R:
2. then i map a share on my server to R: logging on with my domain username and password
3. then i use the robocopy command to copy my user folder under user/username to the mapped drive.

My problem with the program is that after running it, the script spent a whole 24HOURS! backing up the App Data. I had to stop the script from running when i got back from work the next day. The reason why i am backing up my whole User folder is because i would like to backup folders like AppData and Favorites where browser data and Outlook data files are stored.

Can anybody proffer a reason as to why the script seems to take so long backing up AppData and how i can fix the problem.

Thank you
 

My Computer

OS
Windows 7 Professional x64
What is the size of the folder?

The /z switch is known to slow the backup speed considerably - try a test without /z to see what I mean.
 

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
/Z copies in resume mode. This can slow down the process, but it also may provide a better result when copying across a network when network communication is lost temporarily. You'll have to decide if you need it or not.

If you have a multi-threaded processor, you could experiment with assigning more threads to Robocopy. While this may not make much difference for the initial copy, subsequent copies (updating the backup) can be much faster with many threads checking file attributes. e.g. /MT:32 would use 32 threads, whereas default is 8.

Also, remember that the first copy will be slow as every file must be transferred to the backup location. Subsequent copies (updating the backup) will be faster, as Robocopy will check the files and transfer only those that have changed or are new.

Why just the /E backup option? From your description, I would have thought that you would not want to store files that had been deleted from the source C: drive. If you want the backup to replicate the current state of C:, then you can use /MIR, to mirror the directory tree, the same as using /E to include even empty folders (as you have done) plus /PURGE to delete items from backup that you deleted from source. Essentially, if you want the backup to be an exact copy of the source, use /MIR.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell XPS 15 L502X
OS
Windows 10 Home, 64-bit
Hey Guys

I need help with a backup script to do backups on my laptop running Win7 Pro x64 to my Win2008R2 server.
Here is the script i wrote
@echo off
TITLE Backup program

echo Please save any open documents and then close all programs, especially Outlook.
echo off
pause

cls
net use R: /delete
goto begin

:begin
net use R: \\surulere\backup /USER:conet.com\koladapo Kq14lakoil
robocopy C:\Users\Kola R:\Kola /e /z /R:5 /W:1

echo.
echo The backup has finished.

goto done

:done
pause
if exist R: net use R: /d /y
exit

I am sorry i did not put comments to explain the script better. but the summary of what i did is
1. i delete any drives mapped to R:
2. then i map a share on my server to R: logging on with my domain username and password
3. then i use the robocopy command to copy my user folder under user/username to the mapped drive.

My problem with the program is that after running it, the script spent a whole 24HOURS! backing up the App Data. I had to stop the script from running when i got back from work the next day. The reason why i am backing up my whole User folder is because i would like to backup folders like AppData and Favorites where browser data and Outlook data files are stored.

Can anybody proffer a reason as to why the script seems to take so long backing up AppData and how i can fix the problem.

Thank you
Add /XJ switch Robocopy Syntax, Command Line Switches and Examples « My Digital Life
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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
 

My Computer

OS
Windows 7 Professional x64
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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 Computer

OS
Windows 7 Professional x64
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.

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 Computer

OS
Windows 7 Ent. (32)
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 Computer

Computer Manufacturer/Model Number
Dell Optiplex 745
OS
Windows 7 Enterprise x64
CPU
Core2Duo
Memory
8GB DDR2
Graphics Card(s)
nVidia
Sound Card
on-board
Monitor(s) Displays
20"
Screen Resolution
1400x900
Hard Drives
160GB SATA
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 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
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell XPS 15 L502X
OS
Windows 10 Home, 64-bit
Add swich /XJ as well!
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell XPS 15 L502X
OS
Windows 10 Home, 64-bit
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 Computer

OS
Windows 7 Home Premium x64
CPU
Intel i7-2600K
Motherboard
ASUS Sabertooth Z77
Memory
G.SKILL Ripjaws (16 GB Total)
Graphics Card(s)
EVGA GeForce GTX 560 Ti
Monitor(s) Displays
ASUS
Screen Resolution
1920x1080 (2 Monitors)
Hard Drives
Hitachi GST Deskstar 2 TB (HDD)
Samsung 840 Pro 256 GB (SSD)
PSU
SeaSonic X Series X650 Gold
Case
Antec DF 85
Keyboard
Microsoft SideWinder X4
Mouse
MadCatz M.M.O. 7 & Logitech G35
Internet Speed
50 down
Antivirus
Avast Free, SuperAntiSpyware Free, Malwarebytes Free
Browser
Mozilla Firefox
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell XPS 15 L502X
OS
Windows 10 Home, 64-bit
Back
Top