Thursday, October 07, 2010

change permissions of files and folders

On *nix, when you want to change the access permission of a directory and all files and folders in it, you could use :

cd your_dir
chmod -R 750 *
But this doesn't make a distinction between files and folders. So if you want different permissions for files and folders, you can do this :
cd your_dir
find -type f -exec chmod 640 {} \;
find -type d -exec chmod 750 {} \;

No comments: