phreek.org


Thursday, April 24, 2008

Updating permissions on all files and directories within a directory

I extracted a tarball which had applied 777 (rwx) permissions to all files and directories that it contained. I wanted to set all files to 644 and all directories to 755, but there were too many levels to do it manually so I needed to do it through a shell script. After trying various BASH “for” loops, I checked the man page for “find” and was able to do the whole lot in 2 lines:

find . * -type d -exec chmod 0755 {} +
find . * -type f -exec chmod 0644 {} 
Posted by darko (0) Comments | Permalink
Next entry: QOTD Previous entry: Installing Citrix ICA Client 10.6 on Fedora 8

Post a comment

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?