Workaround for ACL and file attributes

Rob Bosch robbosch at msn.com
Mon Dec 17 16:57:27 GMT 2007


Just thought I'd post a simple workaround for Windows ACL's and file
attributes for rsync.  Using some basic scripting will allow ACL information
to be stored for future use on files transferred using rsync.  Most will
probably find the information worthless but thought I'd post it anyway.

- To get ACL information, use the icacls program provided as part of Server
2003 SP1
(http://technet2.microsoft.com/windowsserver2008/en/library/403edfcc-328a-47
9d-b641-80c290ccf73e1033.mspx?mfr=true).  This program can store ACL's for a
given path into a file for restoring the ACL's later.  Running this on the
path for rsync and including the output file in the rsync backup will
provide you with everything required to restore ACL's later.  Just use
something like icacls c:\* /t /save caclfile and then make sure caclfile is
in your rsync capture.

- You can also use a simple dir command to capture all hidden, system, and
read-only files.  For example, running dir /s /b /a:h C:\* > chidden.txt
will profile you with a simple list of hidden files in C:\.  You can run
this script on the directory you are backing up with rsync and make sure the
chidden.txt file is included in the backup.  When you restore, you can use
the command "for /f %a in ('type chidden.txt') do attrib +h %a" to restore
the attributes.  The command will apply the hidden attribute to the files.
If you run the dir command for each type (hidden, system, read-only) you
will have all the information required to restore the files to the original
state in 3 simple text files.

I use these types of simple steps to work around capturing ACL's and
attributes.  It also provides me with a very reliable way of restoring the
files I backed up.  It never hurts to have the additional information
anyway.

Rob



More information about the rsync mailing list