Some program like UNIX 'file', but for Windows?

C

Chaos Master

Hello people.

In UNIX and Linux there's an utility called 'file' which tells you the file
type of a file. e.g.

$ file program.c
program.c: C source code

$ file graphics.jpg
graphics.jpg: JPEG file, 1024x768 pixels, etc..

$ file song.mp3
song.mp3: MP3 audio file, 128Kbps, 44.100Hz, Stereo

Q: Is there any utility like this, but for Windows?

[]s
--
Chaos Master®, posting from Brazil.
"Two of the most famous products of Berkeley are LSD and Unix.
I don't think that this is a coincidence." -- Anonymous

"I'd rather be hated for who I am, than loved for who I am not" - Kurt Cobain

Please reply to news.
 
G

Gary Schmidt

Chaos said:
Hello people.

In UNIX and Linux there's an utility called 'file' which tells you the file
type of a file. e.g.

$ file program.c
program.c: C source code

$ file graphics.jpg
graphics.jpg: JPEG file, 1024x768 pixels, etc..

$ file song.mp3
song.mp3: MP3 audio file, 128Kbps, 44.100Hz, Stereo

Q: Is there any utility like this, but for Windows?
Yes.

Available as part of Cywin, <http://www.cygwin.com>

Or, you can get the source from your nearest GNU mirror.

Or, you can get the source from an archived post in comp.sources.unix
(of course, it won't have an up to date /etc/magic file).

Cheers,
Gary B-)
 
O

omega

Chaos Master said:
In UNIX and Linux there's an utility called 'file' which tells you the file
type of a file. e.g.

I hover my mouse and get bright pink balloons to float up. Is that Unix-ish?

Tooltip extensions dept -
INFOTIPX // I like this
(google says) http://www.na.rim.or.jp/~norio/InfoTipX/preview-e.shtml
Arisesoft File Informer // I haven't used this
(google says) http://www.freedownloadscenter.com/Reviews/r673.html
$ file program.c
program.c: C source code

$ file graphics.jpg
graphics.jpg: JPEG file, 1024x768 pixels, etc..

$ file song.mp3
song.mp3: MP3 audio file, 128Kbps, 44.100Hz, Stereo

Q: Is there any utility like this, but for Windows?

The tooltip enhancements that I bring up, they of course are for visual only,
they do not output report information, so just a shot here whether they'd be
of any interest to you.

If you're looking for a files info report in the form of a data file, that's
a different matter. For that I'd look around in the the disk/CD catalogers
department ...
 
M

Mark R. Blain

In UNIX and Linux there's an utility called 'file' which tells you the file
type of a file. e.g.

$ file program.c
program.c: C source code

$ file graphics.jpg
graphics.jpg: JPEG file, 1024x768 pixels, etc..

$ file song.mp3
song.mp3: MP3 audio file, 128Kbps, 44.100Hz, Stereo

Q: Is there any utility like this, but for Windows?

As previously suggested Cygwin is your best bet, but native Windows
does have a couple of useful related commands:
assoc .txt - tells you that .txt is a "txtfile"
ftype txtfile - tells you what command opens a "txtfile"
start myfile.txt - opens a "txtfile" with the default command
These only care about the filename extension, unlike true unix "file"
which looks at the contents of a file to determine what it is.
 
S

Sietse Fliege

Chaos said:
Hello people.

In UNIX and Linux there's an utility called 'file' which tells you
the file type of a file. e.g.

$ file program.c
program.c: C source code

$ file graphics.jpg
graphics.jpg: JPEG file, 1024x768 pixels, etc..

$ file song.mp3
song.mp3: MP3 audio file, 128Kbps, 44.100Hz, Stereo

Q: Is there any utility like this, but for Windows?


TrID - File Identifier http://mark0.ngi.it/soft-trid-e.html

"TrID is a utility designed to identify file types from their binary
signatures. While there are similar utilities with hard coded rules,
TriID has no such rules. Instead, it is extensible and can be trained to
recognize new formats in a fast and automatic way.
TrID has many uses: identify what kind of file was sent to you via
e-mail, aid in forensic analysis, support in file recovery, etc.

TrID uses an XML-based database of definitions which describe recurring
patterns for supported file types. The first 2KB of a file are examined
for these patterns.

The database of definitions is constantly expanding; the more that are
available, the more accurate an analysis of an unknown file can be. You
can help! Use the program to both recognize unknown file types and
develop new definitions that can be added to the library.

Because TrID uses an expandable database it will never be out of date.
As new file types become available you can run the scan module against
them and help keep the program up to date. Other people around the world
will be doing the same thing making the database a dynamic and living
thing. If you have special file formats that only you use, you can also
add them to your local database, making their identification easier.

To get you started, the current library of definitions is up to 1267
file types and growing fast."
 
S

Susan Bugher

Sietse said:
TrID - File Identifier http://mark0.ngi.it/soft-trid-e.html

"TrID is a utility designed to identify file types from their binary
signatures. While there are similar utilities with hard coded rules,
TriID has no such rules. Instead, it is extensible and can be trained to
recognize new formats in a fast and automatic way.
TrID has many uses: identify what kind of file was sent to you via
e-mail, aid in forensic analysis, support in file recovery, etc.

TrID uses an XML-based database of definitions which describe recurring
patterns for supported file types. The first 2KB of a file are examined
for these patterns.

The database of definitions is constantly expanding; the more that are
available, the more accurate an analysis of an unknown file can be. You
can help! Use the program to both recognize unknown file types and
develop new definitions that can be added to the library.

Because TrID uses an expandable database it will never be out of date.
As new file types become available you can run the scan module against
them and help keep the program up to date. Other people around the world
will be doing the same thing making the database a dynamic and living
thing. If you have special file formats that only you use, you can also
add them to your local database, making their identification easier.

To get you started, the current library of definitions is up to 1267
file types and growing fast."

I had to get me one of those. :)

TrID v1.55 (contains TrID, TrIDScan, 1267 file types) 369KB ZIP

http://mark0.ngi.it/download/trid_w32.zip

but. . .

I can't get the damn thing to work - all it will tell me is "No
definitions available! Download an up to date defs library. . . "

We're talking about not being able to identify a text file, a JPG file
etc. etc. etc.

I'm using Win98. . .

Has anyone got any helpful hints to offer?

Susan
 
C

Chaos Master

Mark R. Blain says:
As previously suggested Cygwin is your best bet, but native Windows
does have a couple of useful related commands:
assoc .txt - tells you that .txt is a "txtfile"
ftype txtfile - tells you what command opens a "txtfile"
start myfile.txt - opens a "txtfile" with the default command
These only care about the filename extension, unlike true unix "file"
which looks at the contents of a file to determine what it is.

I don't seem to have 'assoc' and 'ftype' in my Win 98.
And then, it isn't as good as UNIX tool, e.g.

I receive a file that just got named 'somefile'. I need to know what it is. The
'file' tool is exactly for this.

[]s
--
Chaos Master®, posting from Brazil.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think
that this is a coincidence."
-- Anonymous

"I'd rather be hated for who I am, than loved for who I am not" - Kurt Cobain

The Evanescen(t/ce) HP: http://marreka.no-ip.com
 
C

Chaos Master

Susan Bugher says:
I can't get the damn thing to work - all it will tell me is "No
definitions available! Download an up to date defs library. . . "

Has anyone got any helpful hints to offer?

You have to be in the same directory as TRID is.

e.g.

C:\> CD TRID

C:\TRID>trid c:\meusdo~1\wall\evanescence.jpg

TrID/32 - File Identifier v1.55 - (C) 2003 By M.Pontello

Collecting data from file: c:\meusdo~1\wall\evanescence.jpg
Definitions found: 1267
Analyzing...
(long wait)

92.3% (.JPG/JPEG) JFIF JPEG Bitmap (12000/1)
7.7% (.MP3) MP3 audio (1000/1)

C:\TRID>

Not bad.


[]s
--
Chaos Master®, posting from Brazil.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think
that this is a coincidence."
-- Anonymous

"I'd rather be hated for who I am, than loved for who I am not" - Kurt Cobain

The Evanescen(t/ce) HP: http://marreka.no-ip.com
 
R

Roger Johansson

Chaos Master said:
I receive a file that just got named 'somefile'. I need to know what it
is. The 'file' tool is exactly for this.

I often open such a file in a simple text viewer, or a hex viewer, and
look at the beginning of the file. For many file types it shows in the
first bytes what type it is.

JFIF = jpg, PDF = pdf, PK = zip, BM = bmp, GIF89 = gif, for example

An exe file often has the words "This program cannot be run in DOS mode"
close to the beginning of the file.

That is one of the main uses for a hex editor for me now, because my
standard viewer in Total Commander has become so advanced that it
is no longer useful for this simple purpose, it shows the files as they
should be shown instead.

If you have a simple text editor or tiny hexer in the send-to menu you
can easily see the first bytes of a file.
 
O

omega

Susan Bugher said:
Ah so. Sucess! thank you. :)

For point-click access from the explorer, I put a .pif in the sendto.
That is, first I made a .bat, then I dragged to make a pif shortcut
from it, into the sendto folder.

(I'll just copy my own path here.)

-----trid.bat-----
"I:\inbound\SYSUTILS\trid file id\bin\trid.exe" "%1"
:: append /v at the end if prefer verbose output
-------------------

Since my .bat was in the folder with trid and its data, the drag-creation
of the .pif automatically made the start-in folder needed in those properties.
If I were to use a free-floating homeless bat in some situation instead, then
I'd need two lines. I'd need to start with this one:

cd "I:\inbound\SYSUTILS\trid file id\bin"

.. . .

I was left still with a barrier, when trying to set this up how I like things.
Mainly, that I tend to interact with the commandline most happily with a text
editor. Yet, for TRID, I found that the redirect to file gave a huge amount of
output, compared to what one just received displayed from console window.

-----trid-CRUMMY.bat-----
"I:\inbound\SYSUTILS\trid file id\bin\trid.exe" "%1" >%tmp%\abc123.txt
notepad %tmp%\abc123.txt
-------------------

I suppose my next step, if pursue, would be to go rtfm on a few of the various
console redirect utilities, maybe even one of the console-to-clip ones. Test
to see if I can then get the smaller, more relevant amount of output that I
see in the console window from TRID.

This situation is unusual to me. I don't recall before having this experience
where doing ">output.txt" gives a bunch of extra stuff that is not given when
having it otherwise send straight to the console window.
 
S

Sietse Fliege

omega said:
For point-click access from the explorer, I put a .pif in the sendto.
That is, first I made a .bat, then I dragged to make a pif shortcut
from it, into the sendto folder.

(I'll just copy my own path here.)

-----trid.bat-----
"I:\inbound\SYSUTILS\trid file id\bin\trid.exe" "%1"
:: append /v at the end if prefer verbose output
-------------------

Since my .bat was in the folder with trid and its data, the
drag-creation of the .pif automatically made the start-in folder
needed in those properties.

Hello Karen, :)

Note #1: You can also simply have trid.exe (without PathToTrid)
Note #2: In case of one or more (seperate) spaces in path and/or file
name, the quotes around "%1" serve no purpose.
Better: trid.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
Note #3: In WinXP the console window closes.
One needs to have e.g. pause at the end.

So my trid.cmd (WinXP) reads:

-----trid.cmd-----
trid.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
pause
-------------------
I was left still with a barrier, when trying to set this up how I
like things. Mainly, that I tend to interact with the commandline
most happily with a text editor. Yet, for TRID, I found that the
redirect to file gave a huge amount of output, compared to what one
just received displayed from console window.

-----trid-CRUMMY.bat-----
"I:\inbound\SYSUTILS\trid file id\bin\trid.exe" "%1"
-------------------

I suppose my next step, if pursue, would be to go rtfm on a few of
the various console redirect utilities, maybe even one of the
console-to-clip ones. Test to see if I can then get the smaller, more
relevant amount of output that I see in the console window from TRID.

Or maybe ask the author?
 
M

Mark R. Blain

So my trid.cmd (WinXP) reads:

-----trid.cmd-----
trid.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
pause
-------------------

In WinNT, Win2000, or WinXP you could use %* instead of %1 %2 %3 %4 %5
%6 %7 %8 %9.
 
C

Chaos Master

vince writes within:
Have you looked at unixkit-tiny from J. Blank?
<http://jlb.twu.net/code/unixkit.php>
Has many *nix commands ported to Windows, including file. I've got it
on my thumbdrive for portability between Windows machines.

Cool!
I didn't know about this program.

Thanks!
--
Chaos Master®, posting from Brazil.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think
that this is a coincidence." -- Anonymous
"I'd rather be hated for who I am, than loved for who I am not" - Kurt Cobain

The Evanescen(t/ce) HP: http://marreka.no-ip.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top