Skip to content

Instantly share code, notes, and snippets.

@Abhinickz
Created April 12, 2017 08:16
Show Gist options
  • Save Abhinickz/63c023c5ddfedf0453af61c75868c6bd to your computer and use it in GitHub Desktop.
Save Abhinickz/63c023c5ddfedf0453af61c75868c6bd to your computer and use it in GitHub Desktop.
File::Find use with the tabbed format data!!!
#!/usr/bin/perl
use strict; use warnings; use Data::Dumper;
use File::Find;
$| = 1;
find(\&wanted, './');
sub wanted {
my $file_type = `file -bi $_`;
chomp($file_type);
my ( $mime_type, undef ) = split( /;|\s/, $file_type );
printf ( "%-65s => %-15s\n", $_ , $mime_type );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment