Need help restoring mode and group info. - TechRepublic
General discussion
April 23, 2001 at 04:02 PM
jeff@sb

Need help restoring mode and group info.

by jeff@sb . Updated 25 years, 1 month ago

A script I wrote inadvertently issued errant chmod and chgrp commands recursively on a large directory. I have a similar directory on another unix machine which has not been damaged.

I can’t just copy the files over and recovery from backup is not doable.

I can see how a script could use find to capture the permissions and groups from the unmodified files and create a second script that would issue appropriate chmod and chgrp commands on the damaged ones, but I’m not comfortable with thes, S, t, T bits, and issues such as symbolic links.

Does anyone have a script or other method of copying the group and file modes of a set of files, including sub-directories, symbolic links, etc. and applying them to identically named objects?
Thanks,
Jeff

This discussion is locked

All Comments