Date: Thu, 26 Aug 1999 15:56:21 -0700 (PDT) From: Gary Kline <kline@tera.com> To: iceberg@pobox.com Cc: kline@tera.com, freebsd-questions@freebsd.org Subject: Re: find -f <type> Message-ID: <199908262256.PAA24088@athena.tera.com> In-Reply-To: <19990826170528.A93854@comp04.prc.uic.edu> from Lucas Bergman at "Aug 26, 99 05:05:28 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
According to Lucas Bergman:
> > Is there a way of using find to locate all regular files that
> > are not binaries and also not executable scripts?
>
> The following script (I think) echoes the name of all files off the
> current directory that are text and have no executable bits set. I
> didn't test it that rigorously, so YMMV.
>
> ------------ snip snip snip ------------
> #!/bin/sh
>
> list=`find . \( -type f -and \! -perm -001 \
> -and \! -perm -010 -and \! -perm -100 \) -print`
>
> for file in $list
> do
> if { file $file | grep -i text 2>&1 >/dev/null; }
> then
> echo $file
> fi
> done
> ------------ snip snip snip ------------
>
> Don't count on running this too often, though, cuz it is Slower Than
> Windows (TM).
>
Yup, works, thanks much.
Years ago, 8-10-12, whatever, a shell wiz hacked out something
similar that caught only /bin/sh scripts and COFF binaries.
Yours, using the ``-perm'' switch is better. find is great;
having something like this builtin would be a win... but maybe
be a bit too much feature-creep!
gary
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908262256.PAA24088>
