Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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"}'
Comment on One-liner: Inspecting a browser cache with File::MMagic
Download Code

Back to Snippets Section

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 wandering the Monastery: (4)
As of 2014-10-02 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls