chmod -R vs. spaces in filenames

hazmat

Rusher of Din
I am trying to do a recursive chmod, but it seems to choke on file with spaces in the names, as in all my MP3s. Any suggestions on how to get around this? What I want to do is essentially:

chmod 644 `ls -lR | grep .mp3`

The actual 'ls' command works fine, but chmod complains of the non-existing files because of spaces.

Thanks.
 
That doesn't work. Only applies to the cwd. This worked:

find . -name '*.mp3' -type f -print0 | xargs -0 chmod 644
 
Originally posted by hazmat
That doesn't work. Only applies to the cwd. This worked:

find . -name '*.mp3' -type f -print0 | xargs -0 chmod 644

You know, about 4 years ago, we wouldn't be talking about chmod, find, xargs, grep, etc. on a Mac. I still shake my head in dis-belief. (In a good way!).

Nice solution! I have taken this and added it as an alias in my .cshrc (it works on the SGI/Linux boxes too.)


bob..
 
Back
Top