Kernel word recovery crack, Mobile themes website for samsung wave 525, Dekha ek khwab sony tv title song, Song zombies on your lawn, Bloody mary nerve endings mp3, Digittrade tv jukebox, Padosan songs mp3, Gold cup series 70 manual, Nieuwste versie van mozilla firefox en, Cant install spotify on mac, Web brute force password cracker, Belkin g peek driver windows 7

Script idea

October 17th, 2008 by Martijn Leave a reply »

I noticed I often tend to type the same sequences of commands when I look for files in a directory. For instance: “ls *mp3”, followed by “ls *ogg” if there aren’t any mp3s. Repeating such commands makes me feel like a cymbal-banging monkey, so what I need here is a script that does the boring stuff for me (and guesses my mind. and makes coffee. Damn, I’m hungry now.)

This is a (late night) attempt:

use strict;
use warnings;
use File::Glob qw(:globally :nocase);
my %types = (
    audio => [ qw/mp3 ogg wmv wav voc flac/ ],
    video => [ qw/divx avi wmv ogm flv mpg mpeg/ ],
    pictures => [ qw/jpg jpeg tiff tif pcx bmp png svg/ ],
    archives => [ qw/rpm deb tgz tar.gz zip rar iso/ ],
    docs => [ qw/txt nfo doc pdf/ ],
    web => [ qw/htm html css/ ],
    scripts => [ qw/pl py sh lua/ ],
    code => [ qw/c cpp h hpp/ ],
sub abort_with_help {
    print "Syntax: list <type>\nWhere type in:\n";
    print "* $_: " . join(', ', sort @{$types{$_}}) . "\n" for keys %types;
    exit -1;
abort_with_help unless my $type = shift;
unless (exists $types{$type}) {
    print "No such type.\n";
my $glob = '*.{' . join(',', @{$types{$type}}) . '}';
if (my @files = glob($glob)) {
    print "$_\n" for (@files);
} else {
    print "No $type files found in the current directory.\n";

Leave a Reply

Authorized tags:
[b]bold[/b] [u]underline[/u] [i]italic[/i] [url=http://link.url]link[/url] more