#!/usr/local/bin/perl # # Find & remove dead thumbnails # # File: tnfo.pl # # Author: Nem W Schlecht # Copyright © 2004 Empyreal Technologies # # Creation Date: Apr 12, 2004 # Last Modification: $Date$ # # $Id$ # $Log$ # use File::Find; use Image::Info qw(image_info); find(\&wanted, "$ENV{HOME}/.thumbnails"); sub wanted { my $fn = $File::Find::name; next if (-d "$fn"); push(@files, $File::Find::name); if ($fn =~ /\/fail\//) { print "$fn\n"; unlink("$fn"); next; } my $info = image_info("$fn"); if (my $error = $info->{error}) { print "Can't parse image info: $error\n"; } my $uri = $info->{'Thumb::URI'}; $uri =~ s/^file:\/\///; $uri =~ s/\%20/ /go; my(@stinf) = stat("$uri"); if (!$stinf[0] || $uri =~ /$ARGV[0]/) { print "$uri\n"; unlink("$fn"); } }