On Saturday 11 April 2009 10:00:04 [email protected] wrote:
> > On Saturday 11 April 2009 00:06:56 [email protected] wrote:
> > [snip]
> >
> > > > What am I missing?
> > >
> > > find(1), which is used to locate a list of files matching a given set
> > > of criteria, allowing you to do something like this:
> > >
> > >   chmod -R 644 `find -name '*.jpg'`
> > >
> > > (Note the single-quotes around the glob pattern?  Without that the
> > > shell would expand the pattern, which would cause a syntax error for
> > > the find command, and not do what you want.)
> > >
> > > 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.
> >
> > Um sure, but in this context too complicated IMHO
> > find . -type d -exec chmod 775 {} \;
> > find . -type f -exec chmod 664 {} \;
>
> need "" around the {} for filenames with spaces

Is that a thought experiment ? ... cause I tried it ! exactly as posted

Maybe I should have posted this

[eeyore] /home/jam/slug [60]% ll
total 4
-rw-r--r-- 1 jam users    0 2009-04-11 07:51 silly name
drwxr-xr-x 2 jam users 4096 2009-04-11 07:51 slug/
[eeyore] /home/jam/slug [61]% find . -type d -exec chmod 775 {} \;
[eeyore] /home/jam/slug [62]% ll
total 4
-rw-r--r-- 1 jam users    0 2009-04-11 07:51 silly name
drwxrwxr-x 2 jam users 4096 2009-04-11 07:51 slug/
[eeyore] /home/jam/slug [63]% find . -type f -exec chmod 664 {} \;
[eeyore] /home/jam/slug [64]% ll
total 4
-rw-rw-r-- 1 jam users    0 2009-04-11 07:51 silly name
drwxrwxr-x 2 jam users 4096 2009-04-11 07:51 slug/
[eeyore] /home/jam/slug [65]% ll slug
total 0
-rw-rw-r-- 1 jam users 0 2009-04-11 07:51 silly name
James

--
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