[lug] Recursive chmod

Chip Atkinson catkinson at circadence.com
Fri May 4 09:43:20 MDT 2001


True.  From what I've heard and seen, using xargs is almost always the 
better way to go for performance reasons.

Tkil wrote:

>>>>>> "Chip" == Chip Atkinson <catkinson at circadence.com> writes:
>>>>> 
> 
> Chip> Find is your friend:
> Chip> find . -name "*.html" | xargs chmod a-x
> Chip> or
> Chip> find . -name "*.html" -exec chmod a-x {} \;
> 
> note that the first version should be faster/more efficient than the
> second, if you have lots of files.
> 
> also, you can find both of them with "find" command.  Adding two
> enhancements (files only, as someone else has already mentioned, and
> making it case-insensitive using a gnu extension), and using the
> slightly more secure "-print0" method to avoid getting confused by
> filenames which contain newlines:
> 
>   find . -type -f \( -iname '*.jpg' -o -iname '*.jpeg' -o \
>                      -iname '*.htm' -o -iname '*.html' \) -print0 | \
>     xargs -0 chmod a-x
> 
> t.
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug




More information about the LUG mailing list