The other day I came across an excellent function written by Boe Prox, called Get-FileSignature. His function will read a file and give you the Hex and ASCII signature of the file. I thought a bit about how I could use this function and came across several sites on-line listing the file signatures of known file formats. That got me thinking! What if I could create a function that tried to determine a files type based on its file signature? 

And so the first version of Get-FileType was born. It has only one parameter, a path to a file. Internally it has a list of known file signatures, and it uses Get-FileSignature to check for each of them for each file through the path parameter. The output is an object with a type description and some additional information gotten from Get-FileSignature.

The internal signature list is by all means not complete, but I added some common ones and stuff I personally would find useful. If you use this function, and end up adding more file signatures to the list, please let me know so I can update my function as well!

Remember that you need Get-FileSignature in order for this function to work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s