ROBOCOPY - Create Backup Script

Page 29 of 32 FirstFirst ... 192728293031 ... LastLast

  1. Posts : 7
    Win7 Ult x64
       #280

    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 Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #281

    Those angle brackets should not be there.

    Code:
    robocopy t:\dayzero U:\dayzero /e /np /tee /mt:4 /log:Backup_Log.txt
      My Computer


  3. Posts : 7
    Win7 Ult x64
       #282

    Pyprohly said:
    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 Computer


  4. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #283

    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 Computer


  5. Posts : 7
    Win7 Ult x64
       #284

    I wish i'd never have asked now :) thanks for your help
      My Computer


  6. Posts : 7
    Win7 Ult x64
       #285

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

    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 Computer


  7. Posts : 26,869
    Windows 11 Pro
       #286

    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 Computer


  8. Posts : 7
    Win7 Ult x64
       #287

    essenbe said:
    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 Computer


  9. Posts : 26,869
    Windows 11 Pro
       #288

    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 Computer


  10. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #289

    essenbe said:
    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.


    chrishammond said:
    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 Computer


 
Page 29 of 32 FirstFirst ... 192728293031 ... 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 18:44.
Find Us