From owner-freebsd-questions Fri May 10 06:03:35 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id GAA14180 for questions-outgoing; Fri, 10 May 1996 06:03:35 -0700 (PDT) Received: from nibsc.ac.uk (comsig.nibsc.ac.uk [193.62.43.13]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id GAA14174 for ; Fri, 10 May 1996 06:03:32 -0700 (PDT) Received: from chalsig.nibsc.ac.uk by nibsc.ac.uk via ESMTP (940816.SGI.8.6.9/940406.SGI.1(NIBSC)) id OAA26586; Fri, 10 May 1996 14:01:39 +0100 Received: by chalsig.nibsc.ac.uk (950511.SGI.8.6.12.PATCH526/client-1.3.1(NIBSC)) id OAA17256; Fri, 10 May 1996 14:01:38 +0100 Message-Id: <199605101301.OAA17256@chalsig.nibsc.ac.uk> Subject: Re: running gag: chmod -R .\* To: robin@is.co.za Date: Fri, 10 May 1996 14:01:38 +0100 (BST) Cc: garth@dogbert.systems.sa.gov.au, questions@freefall.freebsd.org In-Reply-To: <199605100628.IAA02818@admin.is.co.za> from "Robin Lunn" at May 10, 96 08:28:13 am From: X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk So far we have (among others):- > > chmod -R 0644 `ls -A` [Mine] >> > Unless the argument list is too long. :-( >> > >> > ls -A | xargs chmod 0644 -R [Nate's good point, and good fix] >ls -A shows directory names with a : before listing the files. [What do _you_ have 'ls' aliased to?] >> Aah, but what about .files in subdirectories? [already covered, '-R' is smart] >> >> #!/bin/csh >> foreach a (`find . -type d -print`) >> cd $a >> chmod 0644 `/bin/ls -1Ad` >> end [ An over long fix for a non problem] >> Note that find won't follow symlinked directories, which is probably a good >> thing. [Agreed] >find . -type f -exec chmod 0644 {} \; > >This finds all files and ignores directories like .. and such. It doesn't >depend on any shell either. [Misses device specials etc. maybe a good thing, but we're here for the total solution] Which all brings me to my final thought. Given that '-R' is smart about .files in subdirectories listed on the command line, we can use this:- chmod -R 0644 . as a replacement for the otherwise excellent ls -A | xargs chmod Everyone happy now ? Mac Assistant Systems Adminstrator @nibsc.ac.uk mac@nibsc.ac.uk (also postmaster) Work: 01707 654753 x 285 Everything else: 0956 237670 (any time) P.S. small prize to the first person that spots the minute deliberate error in this. Larger prize if they provide a fix that's still more elegant than Nate's contribution.