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.

We're recoverying bunches of data from a crashed partition of which we had no backup, using a data recovery software. Files are getting recovered, but file names are lost.

Is there any software or method we could use to automatically scan the file headers to try to determine its type (between the most common ones: image types, different kind of source code text files, compressed files, etc) and automatically put an extension on its random name, to help then processing the data?

Maybe this PHP function will help?

Thanks in advance.

share|improve this question
4  
What OS are you using? Linux has the 'file' command which will identify the file type from the contents. You'd need to wrap a script around it to make it automagic, but that's not a big task... See linux.die.net/man/1/file for man page. –  BobT Jan 7 '13 at 17:14
1  
in addition to file, as @BobT said, you can also, on unix, read the original filenames (including their eventual extension, if any) from the (recovered) directory entries. The tricky part being to match file entry in a directory with a recovered file under another name... –  Olivier Dulac Jan 7 '13 at 17:20
1  
@BobT we don't depend on a particular OS to do this task, we can adapt. Your suggestion seems useful. –  Áxel Costas Pena Jan 7 '13 at 17:39
    
@OlivierDulac, directory entries are unrecoverable, data recovery software is giving random names to files. Thanks anyway ;) –  Áxel Costas Pena Jan 7 '13 at 17:40
1  
Maybe you can recover the dir themselves (ie, the inode who contained a dir entry. That inode will, in turn, contain the former list of files+dirs "directly underneath it", and can be read by several means). The soft maybe rename those directories names too, but their content should still contain the former lists. –  Olivier Dulac Jan 7 '13 at 23:32
show 2 more comments

1 Answer 1

You can use TrID for that. There are versions for both Windows and Linux. It can scan multiple files and with the "-ae" switch it can rename each one adding the guessed extension.

Disclaimer: I'm TrID's developer.

share|improve this answer
    
thanks @Mark0, such an interesting project! Am I missing a -r recursive parameter for asterisk-dot-asterisk mask? –  Áxel Costas Pena Jan 9 '13 at 9:27
    
Thanks @Áxel. Indeed, no directories recursion at the moment; it's coming in a next versions. –  Mark0 Jan 9 '13 at 13:47
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.