ROBOCOPY - Create Backup Script

Page 2 of 32 FirstFirst 123412 ... LastLast

  1. Posts : 16
    Windows 7 64bit
       #10

    Golden said:
    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


  2. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
    Thread Starter
       #11

    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:

    Screenshots and Files - Upload and Post in Seven Forums

    Regards,
    Golden
      My Computer


  3. Posts : 5
    Windows 7 Pro
       #12

    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


  4. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
    Thread Starter
       #13

    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
    Attached Thumbnails Attached Thumbnails ROBOCOPY - Create Backup Script-capture.jpg  
      My Computer


  5. Posts : 207
    Windows 7 Professional 64bit
       #14

    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)

    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? 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


  6. Posts : 2,177
    Windows 8.1 Pro x64
       #15

    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 :)

    ROBOCOPY - Create Backup Script-source.png ROBOCOPY - Create Backup Script-destination.png ROBOCOPY - Create Backup Script-warning.png
    ROBOCOPY - Create Backup Script Attached Files
      My Computer


  7. Posts : 207
    Windows 7 Professional 64bit
       #16

    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 by Trapper; 20 Mar 2012 at 15:31.
      My Computer


  8. Posts : 2,177
    Windows 8.1 Pro x64
       #17

    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


  9. Posts : 2,177
    Windows 8.1 Pro x64
       #18

    Trapper said:
    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


  10. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
    Thread Starter
       #19

    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


 
Page 2 of 32 FirstFirst 123412 ... LastLast

  Related Discussions
Our Sites
Site Links
About 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 09:37.
Find Us