[X-Unix] need help with a command

Eugene list-themacintoshguy at fsck.net
Thu Mar 3 01:00:50 PST 2005


On Wed, Mar 02, 2005 at 01:37:51PM +0000, Stroller wrote:
: 
: On Mar 2, 2005, at 11:41 am, Eugene wrote:
: 
: >: ... 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 "{}" \;
: 
: That'll apply the same permissions to the directories as to the regular 
: files. As Scott said, we want directories to have +xxx permissions, but 
: not h4x0r.sh or tr0j4n.exe which got saved there by mistake.

I wasn't responding to Scott.  I was responding specifically to
the original poster, Don <poolmouse_nyc at mac.com>, and his request.
Don never stated exactly what kind of permissions he wanted to
apply.  And knowing the permissions issues with directories, I
just went for the nastiest single-line command I could think of.


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


More information about the X-Unix mailing list