On Fri, Apr 10, 2009 at 01:00:10PM +1000, Daniel Pittman wrote:
> Kyle <[email protected]> writes:
> 

[snip]

> 
> There is a limit to the number of arguments you can pass to chmod,
> though, so it is generally speaking better to structure that like this:
> 
>   find -name '*.jpg' | xargs chmod -R 644
> 
> That falls apart if any of your filenames have spaces in them, though,
> since xargs splits on *any* whitespace; to work around that use:
> 
>   find -name '*.jpg' -print0 | xargs -0 chmod -R 644
> 
> See the manual pages for the fine detail, obviously.


find \( -name '*.jpg' -a -exec chmod 644 "{}" \; \) -o \( -type d -exec
chmod 775 "{}" \; \)

but this execs for each file rather inefficient, but no worries about
command line length nor about white spaces.

One tool many paths

Alex

I intentionally left out the second -a 

> 
> Regards,
>         Daniel

-- 
The major advances in civilization are processes that all but wreck the
societies in which they occur.
                -- A. N. Whitehead

Attachment: signature.asc
Description: Digital signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to