Is there any why to find all the binary files in a directory? This
will find all the filenames that don't have an extension: ls -1 | nawk
-F. '{ if (length($2) == 0) {print $1;}}' > list-of-names.txt. Is
there a better why to exclude names that are directories?
|
|
0
|
|
|
|
Reply
|
J
|
1/7/2009 6:36:40 PM |
|
J. Doe wrote:
> Is there any why to find all the binary files in a directory? This
> will find all the filenames that don't have an extension: ls -1 | nawk
> -F. '{ if (length($2) == 0) {print $1;}}' > list-of-names.txt. Is
> there a better why to exclude names that are directories?
Probably! Remember that the first character of the output from ls -l
will be "d" if the file is a directory.
The regular expressions to find, or not find, a directory are left as an
exercise for the student!
|
|
0
|
|
|
|
Reply
|
Richard
|
1/8/2009 1:44:22 AM
|
|
On Jan 7, 5:44 pm, "Richard B. Gilbert" <rgilber...@comcast.net>
wrote:
> J. Doe wrote:
> > Is there any why to find all the binary files in a directory? This
> > will find all the filenames that don't have an extension: ls -1 | nawk
> > -F. '{ if (length($2) == 0) {print $1;}}' > list-of-names.txt. Is
> > there a better why to exclude names that are directories?
>
> Probably! Remember that the first character of the output from ls -l
> will be "d" if the file is a directory.
>
> The regular expressions to find, or not find, a directory are left as an
> exercise for the student!
Are we looking for files that are *binary* --
or only files that are NOT *directories* ??
Are we looking for files that are *executable* but might be scripts ??
or only files that are not directories and are binary and are
executable ??
/:-/
|
|
0
|
|
|
|
Reply
|
ThanksButNo
|
1/8/2009 2:22:52 AM
|
|
ThanksButNo wrote:
> On Jan 7, 5:44 pm, "Richard B. Gilbert" <rgilber...@comcast.net>
> wrote:
>> J. Doe wrote:
>>> Is there any why to find all the binary files in a directory? This
>>> will find all the filenames that don't have an extension: ls -1 | nawk
>>> -F. '{ if (length($2) == 0) {print $1;}}' > list-of-names.txt. Is
>>> there a better why to exclude names that are directories?
>> Probably! Remember that the first character of the output from ls -l
>> will be "d" if the file is a directory.
>>
>> The regular expressions to find, or not find, a directory are left as an
>> exercise for the student!
>
> Are we looking for files that are *binary* --
>
> or only files that are NOT *directories* ??
>
> Are we looking for files that are *executable* but might be scripts ??
>
> or only files that are not directories and are binary and are
> executable ??
>
> /:-/
The OP was looking for answers to several questions, of which I
attempted to answer only one.
"file" would give him some clue as to the contents. It will report
files that contain text as text files, etc.
It's one of those questions that leaves me wondering if he is asking us
to do his homework for him! If so, he may pass the course without ever
learning enough to be of any use to him.
|
|
0
|
|
|
|
Reply
|
Richard
|
1/8/2009 2:37:30 AM
|
|