[lug] Recursive chmod

Ken Weinert kenw at ihs.com
Fri May 4 09:30:29 MDT 2001


This doesn't strictly apply here since it's unlikely that you'll have a
directory with a .jpg or .html extension, but using -type f or -type d
for limiting find to listing files or directories (respectivly) can
sometimes give you a one step solution to changing a hierarchy.

(ie, find . -type f -name '*.html' -exec chmod a-x {} \;)

* Chip Atkinson (catkinson at circadence.com) [010504 15:22]:
> Find is your friend:
> 
> find . -name "*.html" | xargs chmod a-x
> or
> find . -name "*.html" -exec chmod a-x {} \;
> 
> This is run from the directory where you wish to apply the changes.  If 
> you wish to apply them to an arbitrary location and down from there, 
> replace the . with the location.
> 
> Chip
> 
> Warren Sanders wrote:
> 
> > I need to chmod -R (recursively) using wild card *.html and *.jpg.  My
> > problem is it doesn't dive into subdirectories when you use wild cards.
> > Is this an all or nothing command?
> > 
> > I first thought I'd set chmod -R 750 Dir/ which covers all files and
> > directories.  Then I wanted to remove the executable from all files which
> > are only html and jpg.
> > 
> > TIA,
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug

-- 
Ken Weinert   kenw at ihs.com 303-858-6956 (V) 303-705-4258 (F)
GnuPG KeyID: 9274F1CE           GnuPG available at http://www.gnupg.org/
GnuPG Key Fingerprint: 1D87 3720 BB77 4489 A928  79D6 F8EC DD76 9274 F1CE
I used up all my sick days, so I'm calling in dead.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20010504/5861df88/attachment.pgp>


More information about the LUG mailing list