ROBOCOPY - Create Backup Script

Page 19 of 32 FirstFirst ... 9171819202129 ... LastLast

  1. Posts : 26
    Windows 10 Home, 64-bit
       #180

    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


  2. KKP
    Posts : 2
    Win7 32 Bit
       #181

    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 by KKP; 14 Dec 2012 at 09:29.
      My Computer


  3. Posts : 26
    Windows 10 Home, 64-bit
       #182

    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


  4. Posts : 2
    Server 2008 R2 and windows 7 64-bit
       #183

    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


  5. Posts : 2
    Server 2008 R2 and windows 7 64-bit
       #184

    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


  6. kqo
    Posts : 3
    Windows 7 Professional x64
       #185

    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


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

    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


  8. Posts : 26
    Windows 10 Home, 64-bit
       #187

    /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


  9. Posts : 10,796
    Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
       #188

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


  10. kqo
    Posts : 3
    Windows 7 Professional x64
       #189

    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


 
Page 19 of 32 FirstFirst ... 9171819202129 ... 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 08:26.
Find Us