[svlug] How do I recursively chmod 0664 files but not directories?
Robert Hajime Lanning
lanning at lanning.cc
Thu Jul 14 12:21:02 PDT 2005
<quote who="K. Ari Krupnikov">
> "Daevid Vincent" <daevid at daevid.com> writes:
>> What magical bash incantation can I type to recursively go through
>> and make all files 0664 but make directories 0775?
> Not the cleanest, but I'd use
> chmod 0664 `find /mydir -type f`
I do this:
find $DIR -type f -print0 | xargs -0 chmod $FILEMODES
find $DIR -type d -print0 | xargs -0 chmod $DIRMODES
The "-print0" and "-0" are GNU options, so not portable everywhere,
but makes it easy to handle names with spaces in them. (Samba shares
and the likes.)
Using "xargs" allows for very large directory trees. As xargs
will fork() the command every time it reaches max argv size.
And, did Guloka think the Ulus were too ugly to save?
More information about the svlug