Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a directory full of randomly named files of different types, all with no file extensions. Most are images, with some videos, and some plaintext. I've used one of the Windows versions of file to confirm the files can all be identified by their headers/metadata, but would like to automate the naming as there are roughly 2400 files.

I don't care so much about the filename as much as just having the appropriate extension for it's type. Is anyone aware of a program or script that can do this?

share|improve this question
add comment

2 Answers

I've been told that this http://www.rlvision.com/flashren/about.asp works. Though I've never been in a place to test.

If it seems to be a dud, http://gnuwin32.sourceforge.net/packages/file.htm has the linux file() command rewritten for use in a windows environment. then run a nice batch like this:

@echo off
dir /b "c:\(path to folder containing files)" >>files.txt
for /f %%i in (files.txt) do (
##use file /b and a set of conditionals with find to parse extensions  
based on header) del filelist.txt

Good Luck!

share|improve this answer
add comment

Under windows, there is filetype.exe and does exactly what you need. You can download it from here: http://home.fnal.gov/~jklemenc/filetype.html. It also contains a mini help.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.