harrimann Posted October 4, 2010 Posted October 4, 2010 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
morganw Posted October 4, 2010 Posted October 4, 2010 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
harrimann Posted October 4, 2010 Author Posted October 4, 2010 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..
morganw Posted October 4, 2010 Posted October 4, 2010 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.
harrimann Posted October 4, 2010 Author Posted October 4, 2010 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!!
faizanayaz Posted January 5, 2011 Posted January 5, 2011 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.
morganw Posted January 5, 2011 Posted January 5, 2011 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now