Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

One-liner: Inspecting a browser cache with File::MMagic

by missingthepoint (Friar)
on Feb 28, 2009 at 02:01 UTC ( #747067=snippet: print w/ replies, xml ) Need Help??
Description: Browser caches are interesting places. Firefox, in particular, has many files all with intuitive names like 'FA509DE4d01', and no extensions. Fortunately Unix culture has a method for bringing order to this chaos: 'magic' databases, or files containing bytes found in particular types of files. These allow you to guess a file's type based on its contents. Perl provides 'magic' support in the form of File::MMagic, and the following one-liner uses it to print the guessed types of all files in the current directory. (Update: typo, and removed useless Data::Dumper)
perl -MFile::MMagic -e '$mm=File::MMagic->new; for(glob("*")){$res=$mm
+->checktype_filename($_);print "$_:\t$res\n"}'
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://747067]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2016-06-25 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (325 votes). Check out past polls.