MattDLEA Posted October 23, 2012 Posted October 23, 2012 Think this should be easy. Im trying to make a batch file that runs daily. I am using robocopy to copy the data across So I have robocopy c:\source D:\dest /MIR /DCOPY:t however instead of it copying to D:dest i would like to to copy to D:backup(todaysdate)
VeryPC_Tom_M Posted October 23, 2012 Posted October 23, 2012 Think this should be easy. Im trying to make a batch file that runs daily. I am using robocopy to copy the data across So I have robocopy c:\source D:\dest /MIR /DCOPY:t however instead of it copying to D:dest i would like to to copy to D:backup(todaysdate) Try robocopy c:\source d:\backup%date:~-4,4%%date:~-7,2%%date:~-10,2% /MIR /DCOPY:t
TheCrazyTechnician Posted October 23, 2012 Posted October 23, 2012 sorry to ask a different question but I'm setting Robocopy up now and just want to ask, does the MIR switch mean that the copy will be incremental? I've read that on another site but want to make sure that's correct before i include it
Steve21 Posted October 23, 2012 Posted October 23, 2012 sorry to ask a different question but I'm setting Robocopy up now and just want to ask, does the MIR switch mean that the copy will be incremental? I've read that on another site but want to make sure that's correct before i include it No, Mir is mirror. aka create exact same copy. To create incrementals I generally base it on then archive bit, thus only do files that have changed each time. Steve 1
Steve21 Posted October 23, 2012 Posted October 23, 2012 If anyones interested (and now that I'm at home) this is what I'm running at home for our backups to NAS. md "\\MYNAS\StevePC\%date:/=-% D Backup" robocopy D:\ "\\MYNAS\StevePC\%date:/=-% D Backup" /LOG:"\\MYNAS\StevePC\%date:/=-% D Backup\Log.txt" /TEE /NDL /M /S /R:0 /W:2 /XJ /B /XF *thumbs.db* *ntuser.dat* /XD "$RECYCLE.BIN" "System Volume Information" "ProgramData" "C:\Windows" "C:\Program Files" "C:\Program Files (x86)" *Temporary* "C:\Users\Steve\Favorites" To explain it a bit: md "\\MYNAS\StevePC\%date:/=-% D Backup" Make new folder daily for changes to pc. robocopy D:\ "\\MYNAS\StevePC\%date:/=-% D Backup" Copy D drive to my NAS with todays date in folder. /LOG:"\\MYNAS\StevePC\%date:/=-% D Backup\Log.txt" Write logs to log file. /TEE /NDL /M /S /R:0 /W:2 /XJ /B Output to console as well as log Don't log folder names, only files Only copy files with archive bit (then remove archive) aka incremental Copy sub folders No retries Ignore junction points Use backup operator (stops permission issues) /XF *thumbs.db* *ntuser.dat* /XD "$RECYCLE.BIN" "System Volume Information" "ProgramData" "C:\Windows" "C:\Program Files" "C:\Program Files (x86)" *Temporary* "C:\Users\Steve\Favorites" Ignore certain files, and directories. So every time it runs it'll create a new folder on my NAS, and only copy files that have changed/new into it, log it and mark it all not to archive again. Steve 1
zag Posted November 23, 2012 Posted November 23, 2012 Great stuff. I've just setup robocopy to mirror our main file server with a batch file whenever I feel like it. Works really well so far.
irsWorkshop Posted December 13, 2012 Posted December 13, 2012 Better than using scripts and/or batch files is to use Karen Replicator; Karen's Replicator Does the writing for you.
MattDLEA Posted January 16, 2013 Author Posted January 16, 2013 (edited) Sorry to bring this back up but does /MIR mean I dont have to use /B I understand that /B is back up mode ( but what is back up mode?) So say if I want to copy user directories from the server to a NAS if I have to do a restore from the NAS to the server is it posible for me to run the batch file but just swap the source and dest paths around. Or would i have to play around with permisions? Or would a COPYALL or SEC be more usefull? Edited January 16, 2013 by MattDLEA
Steve21 Posted January 16, 2013 Posted January 16, 2013 Sorry to bring this back up but does /MIR mean I dont have to use /B I understand that /B is back up mode ( but what is back up mode?) So say if I want to copy user directories from the server to a NAS if I have to do a restore from the NAS to the server is it posible for me to run the batch file but just swap the source and dest paths around. Or would i have to play around with permisions? B and MIR are nothing at all linked. B uses a super user with backup operator so you can copy files that normally you don't have access to. (Even those that admins have denied access to) In terms of the copying back, honestly not sure, haven't tried doing it with the same line Steve 1
MattDLEA Posted January 16, 2013 Author Posted January 16, 2013 Thanks Steve, I mean if i use robocopy c:\Staffprofiles NAS:\backupstaffprofiles /MIR /DCOPY:t /COPYALL /B That should copy all the staff profiles and permisions. In our Staffprofile folder we have joeblog(folder) which i can get in to and then joeblog.V2 which I cant get in to (when logged on the server as admin) not that i want to get in. What I'm getting at is if all staff profiles break would it be as simple as robocopy NAS:\backupstaffprofiles c:\Staffprofiles /MIR /DCOPY:t /COPYALL /B Or would there be a different way to disaster recover?
Steve21 Posted January 16, 2013 Posted January 16, 2013 Thanks Steve, I mean if i use robocopy c:\Staffprofiles NAS:\backupstaffprofiles /MIR /DCOPY:t /COPYALL /B That should copy all the staff profiles and permisions. In our Staffprofile folder we have joeblog(folder) which i can get in to and then joeblog.V2 which I cant get in to (when logged on the server as admin) not that i want to get in. What I'm getting at is if all staff profiles break would it be as simple as robocopy NAS:\backupstaffprofiles c:\Staffprofiles /MIR /DCOPY:t /COPYALL /B Or would there be a different way to disaster recover? Aye looks right off hand, guess only thing you could change is with restore I'm guessing you would want things like checking if there's already a newer version etc? If some work is lost, others not. Or is this "major" disasters only? Steve
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