I have a question. So I have 2 folders, both of which have the same files in them, but some with different content, but the same names. What I want to do is clone all of the file permissions from one folder, into the permissions for another folder. Is this possible?
Asked
Active
Viewed 7,140 times
2 Answers
0
This is a duplicate of Unix: Is there a way to "copy" file or directory permissions? .
You can achieve this by typing this:
chmod --reference=RFile file
Dominik Hadl
- 161
-1
This seems work for me:
$ sudo chmod --reference foo/ baz/*
stderr
- 10,394
- 2
- 32
- 49
-
3On my system (coreutils 8.13) that copies the permissions from the
foodirectory to each file inbar. – Paulo Almeida Jul 30 '13 at 00:15
chmod -R --reference=/home/tcagame_svc4/karl/4/garrysmod/ /home/tcagame_svc7/stefen/7/garrysmod/– user1307079 Jul 29 '13 at 23:09for i in foo/*; do j=$(basename $i); chmod bar/$j --reference foo/$j; done(you want to copy the permissions fromfootobarand they are flat directories). – Paulo Almeida Jul 30 '13 at 00:12bartofoo, go intobarand type this:find . -exec chmod --reference={} ../foo/{} \;(this assumesfooandbarare at the same level; if not, adjust the path in theexeccommand). – Paulo Almeida Jul 30 '13 at 01:07