#!/bin/bash #you need to do a wget here. image_path=some_path image_dest=some_other_path for i in `ls ${image_path}*.jpg` do mv -f $i ${image_dest}/image-`stat -c "%Y" $i`.jpg done touch .rename.config.txt ./convert_day.pl ${image_dest}/* #### #!/usr/bin/perl use strict; use Time::localtime; use Data::Dumper; my %pics; my %exec_hash; my @elements; my $FH; my $final_path="some_path"; # the user should ensure that this script is only run serially open(FH, "< .rename.config.txt"); my $line; my $lines = ""; while (defined ($line = )){ $lines .= $line; } %exec_hash=%{eval $lines} unless $lines eq ""; close(FH); # create the movie names and add images to the movies for(@ARGV){ my $temp = $_; my $tm = localtime((stat($temp))[8]); my $nm = sprintf("%02d%02d%04d", $tm->mon+1, $tm->mday, $tm->year+1900); push @elements, $nm unless defined $pics{$nm}; $pics{$nm} = [] unless defined $pics{$nm}; push @{$pics{$nm}}, $temp; } # convert the images to movies for(@elements){ my $t = $_; my $line = "convert -delay 10 " . join(" ", @{$pics{$t}}) . " ".$final_path."/" . $t . ".mpg 2>/dev/null 1>/dev/null" ; # As processing a lot of images takes a long time # only update those images which have changed if(!defined($exec_hash{$t}) || $exec_hash{$t} ne $line){ system $line; $exec_hash{$t} = $line; } } my $save = pop @elements; system "cat ".$final_path."/". (pop @elements) .".mpg ".$final_path."/". $save . ".mpg > ".$final_path."/current.mpg" ; open($FH, ">.rename.config.txt"); $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; print $FH Data::Dumper->Dump([\%exec_hash],['exec_hash']); close($FH);