[X-Unix] need help with a command

Eugene list-themacintoshguy at fsck.net
Wed Mar 2 03:41:23 PST 2005


On Tue, Mar 01, 2005 at 12:43:45PM -1000, Scott J. Kramer wrote:
: 
: --On Tuesday, March 1, 2005 16:28 -0500 PoolMouse <poolmouse_nyc at mac.com> 
: wrote:
: 
: >how do i create a script that applies permissions (recursively) to a
: >directory...on all contents/subdirectories/etc, EXCEPT folders beginning
: >with:
: >
: >	~ARCHIVE
: 
: Assuming that's really a directory starting with a tilde '~' character
: and not user ARCHIVE's home directory, something like:
: 
:  find PATH -not \( -type d -a -name '~Archive' \) -exec chmod MODE {} \;
: 
: But that'll match special files, e.g. symlinks and sockets.  Also,
: sometimes it's best handling directories and non-directory files
: separately when changing permissions, e.g. setting the 'x' (execute)
: bit makes sense for directories but not for non-executable traditional
: Unix files.  So, you could construct two commands like:
: 
:  find PATH -type d -not -name '~Archive' -exec chmod DIR-MODE {} \;
:  find PATH -type f -exec chmod NONDIR-MODE {} \;
: 
: ... for changing dirs and regular files separately.

Or do it all at once?

	find PATH \(-type d -o -type f) -not \( -type d -a -name '~Archive' \) -exec chmod MODE "{}" \;


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/


More information about the X-Unix mailing list