zenkaon
December 15th, 2008, 12:22 PM
Hello,
I am in need of a script that will change the permissions of lots of directories and files, but my scripting is rusty.
I am looking to set the chmod of all directories to 2775 and all files within those directories to 0644.
I have been recommended using:
find ./ -type d -exec chmod 2775 '{}' \;
find ./ -type f -exec chmod 0664 '{}' \;
Which would work fine if I didn't have spaces in my directory and file names. My files are organised like:
~/Some Band/There first Album/01 - Some Song.ogg
The find lines above can't find the directory "Some" or the directory "Band" and hence doesn't do what I want.
Can anyone cook up a shell script which would do what I'm after?
Cheers
I am in need of a script that will change the permissions of lots of directories and files, but my scripting is rusty.
I am looking to set the chmod of all directories to 2775 and all files within those directories to 0644.
I have been recommended using:
find ./ -type d -exec chmod 2775 '{}' \;
find ./ -type f -exec chmod 0664 '{}' \;
Which would work fine if I didn't have spaces in my directory and file names. My files are organised like:
~/Some Band/There first Album/01 - Some Song.ogg
The find lines above can't find the directory "Some" or the directory "Band" and hence doesn't do what I want.
Can anyone cook up a shell script which would do what I'm after?
Cheers