Link to home
Start Free TrialLog in
Avatar of bergquistcompany
bergquistcompany

asked on

How to use Robocopy to resync two file servers and file/folder permissions

Hello,

I am putting a file server in a branch office.  I originally copied all of the file/folder data from the corporate file server onto the branch file server before shipping it out.  Now that it is onsite and they are ready to go live I'd like to resync from corporate to branch given I've made several changes to permissions and document changes within the corporate file server.

I tried \\hoppy\frshare \\hkfile\frshare /mir

but I'm getting access denied.  Is this the proper syntax or am I doing something wrong?
Avatar of Member_2_2473503
Member_2_2473503
Flag of Philippines image

I would use total commander for this.  They have a nice sync tool that can sync up all the files on both sides, and it is free.

Here are some how to guides that will help

http://www.ghisler.com/advanced.htm

eb
Avatar of bergquistcompany
bergquistcompany

ASKER

does this sync user permissions and ownership on folders?
If you use the copy function yes it will copy permissions and ownership (configurable option) but it appears it does not copy permissions and ownership when using the synchronize function.

If all the file synchronization is one way (old server to new server) then you can just tell total commander to do a copy and to overwrite older/ smaller files on the destination.  If there are files changed on both servers you need to use the sync function.

You can use setacl http://helgeklein.com/setacl/ to export and import file permissions and ownership if total commander does not copy them properly.

setacl has a free command line version and a very inexpensive GUI (setaclstudio).  I use this at lest once a week to fix permission issues so even if you don't need it for this job it is a good tool to have.
I'd like to use one program if possible to do this and I thought robocopy did.
YOu said copy in total commander will?  If so how do you copy I don't see that in commands?
ASKER CERTIFIED SOLUTION
Avatar of Leon Fester
Leon Fester
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Copy in total commander will, there are a few things you need to do.

First open it
and navigate to your source on the left pane and destination on the right]

Next select the files you want to copy from left to right then simply drag them over to the destination.

An options window will pop up and one of the options is to copy NTFS permissions.

BTW I also found this info on robocopy that should tell you how to do it with robocopy if you prefer.

http://burpee.smccme.edu/studenthowtos/robocopy.htm

eb
I didn't get the popup window

If I run the command line as follows
Robocopy \\hoppy\bqcorp1\frshare \\hkfile\bqcorp1\frshare  /COPYALL /B /SEC /MIR /R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL

This will copy everything under FRShare from Hoppyt to HKFile including permissions?
If contents are there from an original sync it will overwrite?
See dvt_localboy's comments above there is a good script for doing it with robocopy.
So just create a batch file with this in it and all I have to change is the source and destination?
Is this using Robocopy?  Do I have to alter something in the last line or not?

If file changes and permission changes were made on the backup server they will be corrected by overwrites?
Looks like it uses robocopy and you just need to change the source and destination and then run the .bat file.

If you are on Svr 2008 I would open CMD as an admin and run the .bat from there or you may run into some security issues.

eb
I do and get maximum setlocal recursion level reached over and over
Use the last Robocopy commands that I posted. The /Mir switch mirrors the content from source to destination. /sec says to copy security permissions. If any folders are added or deleted or permissions are changed then those changes will be replica to the destination folder
Use the last Robocopy commands that I posted. The /Mir switch mirrors the content from source to destination. /sec says to copy security permissions. If any folders are added or deleted or permissions are changed then those changes will be replicated to the destination folder. The batch file will explains the rest of the switches. Otherwise type robocopy /? For more help.
ok tried that and getting
2013/01/17 17:43:38 ERROR 5 (0x00000005) Creating Destination Directory \\hkfile\bqcorp1\frshare\Materials\SFE Cycle Count Data\whse SH1 FG\2009\feb 09\
Access is denied.
ERROR 5 (0x00000005) Creating Destination Directory \\hkfile\bqcorp1\frshare\Materials\SFE Cycle Count Data\whse SH1 FG\2009\feb 09\

Access denied is a permissions issue on the account that you're using to run the command.
You don't have sufficient permission to create the folders mentioned in the error message.
is it lack of permisison on the source or destination because from the source I can browse and manually create folders as tests
Destination folder

ERROR 5 (0x00000005) Creating Destination Directory \\hkfile\bqcorp1\frshare\Materials\SFE Cycle Count Data\whse SH1 FG\2009\feb 09\