/usr/share/doc/libimage-exif-perl/examples/rename.pl is in libimage-exif-perl 2.01-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/perl -w
# author : sergey s prozhogin (ccpro@rrelaxo.org.ru)
# script renames file by EXIF date
# for information start perl rename.pl
#
# v 1.3 May-20-2004
#
use strict;
use Image::EXIF;
use Date::Parse;
use Data::Dumper;
my @list = `ls -1 *JPG *jpg *jpeg *JPEG`;
my $exif = new Image::EXIF;
for my $fname (@list)
{
chomp $fname;
$exif->file_name($fname);
my $data = $exif->get_all_info();
if ($data)
{
my $timestamp = $data->{image}->{'Image Created'} || $data->{other}->{'Image Generated'};
my $time = str2time($timestamp);
$timestamp = sprintf "%x", $time;
my $count = 0;
while (-f "img_$timestamp$count.jpg")
{
$count ++;
}
rename $fname, "img_$timestamp$count.jpg";
}
}
|