+ Post New Thread
Results 1 to 7 of 7
Scripts Thread, Robocopy Script in Coding and Web Development; ...
  1. #1

    Join Date
    Oct 2010
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Robocopy Script

    Hey guys (and grils)

    So I just got a new job as an IT – Assistant, I am incharge of maintaing some backups for this office. They were using the following robo copy commands to backup all the My Documents on all the systems in the office (about 80 machines in all). I can’t for the life of me figure out what this loop is doing…


    G:
    cd \Eureka\MyDocBack

    for /D %%f in (*) do c:\batch\Scheduled\Robocopy "\\%%f\c$\my documents" "G:\Eureka\MyDocBack\%%f" /XD Laptops /XF *.m4a *.mp3 *.wma *.rmx /E /R:1 /W:1 /Log+:G:\Eureka\RoboLogs\%%f_Log.log /NP /TEE

    c:\batch\Scheduled\Robocopy "\\kpryor\d$\my documents" "G:\Eureka\MyDocBack\kpryor" /E /R:1 /W:1 /Log+:G:\Eureka\RoboLogs\kpryor_Log.log /NP /TEE

    c:\batch\Scheduled\Robocopy "\\viper\e$\outlook" "G:\Eureka\MyDocBack\Viper-!\outlook" apw.pst archive.pst /E /R:1 /W:1 /NP /Log+:G:\Eureka\RoboLogs\viper_Log.log /NP /TEE

    I understand that its putting the data on the G: drive and in the \Eurkea\MyDocBack folder.. what I don’t understand is the for part.. any help..

    Short story short.. whenever I rollout a new machine with the UserName(Date) Example¨Harri1010 it will not pickup the new machine, thus not getting the backup..

    Where is this getting allt he comp names??

    Thanks

    -Harri

  2. #2
    morganw's Avatar
    Join Date
    Apr 2009
    Location
    Cambridge
    Posts
    816
    Thank Post
    46
    Thanked 132 Times in 126 Posts
    Rep Power
    39
    It looks like the computer names come directly from the folder names that are found in G:\Eureka\MyDocBack.

    The 'For' part is basically saying for each directory in the current folder (G:\Eureka\MyDocBack) - do this. %%f represents the folder name, which gets passed into the robocopy options as a computer name.

    The rest looks hard coded for the computer called kpryor and viper so that isn't going to do anything different regardless of how the folders change.

    To add a new computer to back up I would just make a folder for it. i.e. G:\Eureka\MyDocBack\Harri1010

  3. #3

    Join Date
    Oct 2010
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    thanks thats what i thought it was doing.. so i need to manually ad the computers to the mydoc folder.. thanks guys.. just double checking..

  4. #4
    morganw's Avatar
    Join Date
    Apr 2009
    Location
    Cambridge
    Posts
    816
    Thank Post
    46
    Thanked 132 Times in 126 Posts
    Rep Power
    39
    If you aren't familar with robocopy there is a lot of good documentation for all of the switches
    Robocopy

    You might want to to increase the values on /R and /W to something like higher like /R:3 /W:30 for a backup in case you get a temporary network or power fault during the backup.

  5. #5

    Join Date
    Oct 2010
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks, I was told it was generating the folders from another means. I will take a look at the Robocopy docs.. thanks for the quick reply.. you guys rock!!

  6. #6

    Join Date
    Jan 2011
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    updated files

    I just want to know if there is any option to take regular backups using robocopy which only replaces the updated files and not the same files over and over again taking up time.


    e.g
    Source
    Task1.doc - updated 10-10-2010
    Task2.doc - updated 10-10-2010
    Destination
    Task1.doc - Updated 11-09-2010
    Task2.doc - updated 10-10-2010

    so considering above scenario is there any option so that robocopy skips Task2.doc and only replace Task1.doc

    Your quick response will be highly appreciated.

  7. #7
    morganw's Avatar
    Join Date
    Apr 2009
    Location
    Cambridge
    Posts
    816
    Thank Post
    46
    Thanked 132 Times in 126 Posts
    Rep Power
    39
    If using robocopy you'll probably want to use the archive bit to differentiate between modifed and unmodified files.

    /A : Copy only files with the Archive attribute set.
    /M : like /A, but remove Archive attribute from source files

SHARE:
+ Post New Thread

Similar Threads

  1. Using Robocopy
    By MGTechman in forum Windows Vista
    Replies: 8
    Last Post: 6th November 2009, 04:43 PM
  2. Robocopy Help
    By Gatt in forum Windows
    Replies: 2
    Last Post: 11th July 2008, 11:06 AM
  3. Robocopy Help
    By soze in forum How do you do....it?
    Replies: 15
    Last Post: 2nd June 2008, 02:42 PM
  4. Robocopy
    By acrobson in forum How do you do....it?
    Replies: 16
    Last Post: 22nd December 2007, 01:41 PM
  5. Backup Script for NT backup and Robocopy
    By ChrisH in forum Scripts
    Replies: 12
    Last Post: 20th October 2005, 01:01 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •