From 7fad3f17eb256fb25402fe4a4481a4b077502594 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 22 Feb 2011 20:21:28 +0100 Subject: Remove thumbnails of deleted images --- bin/dthumb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bin/dthumb b/bin/dthumb index 00f6b8b..06b7451 100755 --- a/bin/dthumb +++ b/bin/dthumb @@ -63,6 +63,20 @@ while (my $line = ) { } close($lightbox); +if (-d $thumbdir) { + opendir(my $thumb_dh, $thumbdir); + for my $file (readdir($thumb_dh)) { + if ($file =~ qr{^\.}) { + next; + } + + if (not -e $file) { + unlink("${thumbdir}/${file}"); + } + } + closedir($thumb_dh); +} + open(my $index, '>', $file_index); print $index <<"EOD"; @@ -311,8 +325,7 @@ None. =head1 BUGS AND LIMITATIONS -There is no detection for changed images, the thumbnails of deleted images are -not removed. +Thumbnails of changed images are not yet recreated. When used with B<-x>, the completer tar archive is kept in memory, leading to enormous memory usage and possibly out-of-memory errors. -- cgit v1.2.3