I need to use chmod to change all files recursivly to 664. I would like to skip the folders. I was thinking of doing something like this
ls -lR | grep ^-r |
Another way to do this is to use find ... -exec ...
as follows:
find . -type f -exec chmod 644 {} \;
The problem is that the -exec
starts a chmod
process for every file. The xargs
approach avoids this, and is superior provided that you have a version of find
and xargs
that can cope with the "spaces in pathnames" problem; see the accepted answer.
And for the record, using back-ticks is going to break if there are too many files to be chmoded, or the aggregated length of the pathnames is too large.