Date: Fri, 10 May 1996 14:01:38 +0100 (BST) From: <mac@nibsc.ac.uk> To: robin@is.co.za Cc: garth@dogbert.systems.sa.gov.au, questions@freefall.freebsd.org Subject: Re: running gag: chmod -R .\* Message-ID: <199605101301.OAA17256@chalsig.nibsc.ac.uk> In-Reply-To: <199605100628.IAA02818@admin.is.co.za> from "Robin Lunn" at May 10, 96 08:28:13 am
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605101301.OAA17256>
