#!/usr/bin/perl # picture-toucher.pl # Touches JPG files based on the folder that they are in # Assumes default F-Spot directory layout # GPL 2 license # Ted Carnahan, ted@tedcarnahan.com, 2007-Mar-17 use strict; use warnings; use File::Touch; use DateTime; my $files = `find . -type f -iname "*jpg"`; my $count = 0; foreach my $filename (split /\n/, $files) { print $filename; my $ts = $filename; $ts =~ s!^\./!!; my @a = split /\//, $ts; $ts = sprintf "%4d%02d%02d1200", $a[0],$a[1],$a[2]; my $dt = DateTime->new(year => $a[0], month => $a[1], day => $a[2], hour => 12, minute => 00, second => 00); my $epoch = $dt->epoch; my $toucher = File::Touch->new( mtime => $epoch, no_create => 1); print "\t\t=> $ts ($epoch)\n"; $toucher->touch($filename); $count++; } print "Touched $count files\n";