/ Published in: Bash
-print0 and -0 are used to allow for spaces and other wacky chars in file names
Expand |
Embed | Plain Text
find . -type f -print0 | xargs -0 chmod 644
Comments
Subscribe to comments
You need to login to post a comment.

You can try directly this:
find . -type f -exec chmod 644 '{}' \;
That would work unless there are some really wacky filenames. That's the main reason I'm using the -print0 pattern.
See this URL for more info: http://www.gnu.org/software/findutils/manual/htmlnode/findhtml/Problems-with-_002dexec-and-filenames.html
xargs is also much faster.
Here are a couple other interesting links for those who care to dig deeper.
Linux: xargs vs. exec {}
find -exec cmd {} + vs | xargs