Skip to content

Instantly share code, notes, and snippets.

@ypresto
Created February 19, 2012 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypresto/1866360 to your computer and use it in GitHub Desktop.
Save ypresto/1866360 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
#package UrlFile;
use Config::Simple;
use File::Basename;
my $suf_regex = qr/\.url$/i;
my $dir = $ARGV[0];
if (!opendir(DIR, $dir)) {
print "cannot open dir\n";
exit 1;
}
foreach (grep{ /\.url$/i && -f "$_" } map{ "$dir/$_" } readdir(DIR)) {
my $file = $_;
my @filep = fileparse($file, $suf_regex);
my $cfg = new Config::Simple($file);
my $url = $cfg->param('InternetShortcut.URL');
print "$filep[0] : $url\n";
}
closedir(DIR);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment