OK, whipped together a quick perl script that will hopefully do what you want. To use this, paste the following code into text edit, and save it as something like "rename.pl" in a directory of your movies. Note this will only work on files in the current directory. So, if you have a bunch of folders, you will have to copy it into each folder and run it.
To run this, start a terminal window. change to the directory where your movies are. If you don't know how to change directories in terminal, do this:
type cd
Open a finder window. Drag the folder that has your movies in it into the terminal window. That will paste the directory into the terminal. Press return. Then, type:
perl rename.pl (or whatever you named the script. Note, you remembered to copy it into this folder, right?)
*** USE AT YOUR OWN RISK ****
I suggest you make a backup copy of files first and do a couple of test runs, as it will change the dates on any avi file in this directory.
Code:
use Cwd;
use strict;
my $dir = getcwd();
#print "Dir is $dir\n";
#Read test dir contents
opendir(TESTDIR, $dir);
my @allFiles = sort readdir(TESTDIR);
#print STDOUT "Got all files:\n\t", join "\n\t", @allFiles, "\n";
#Start date of 2013 Jan 1
my $startDate = "0101" ;
my $startHour = 1; #1am
my $startMin = 0;
my $cnt;
foreach my $item (@allFiles){
chomp($item);
#Remove anything that starts with a . (gets rid of ., ..)
next if ($item =~/^\./);
#print "item is $item\n";
if ($item =~ /(.*)(\d+)\.avi$/ ) {
# print "Got a match $1 and $2\n";
# push (@renameFiles, $item) ;
$startMin++;
if ($startMin >= 60) {
$startHour++;
$startMin = 0;
}
if ($startHour > 12) {
$startDate++;
$startHour=0;
}
my $ts= $startDate . sprintf ("%02d", $startHour) . sprintf ("%02d", $startMin);
my $cmd = "touch $ts \"$item\" ";
# print "cmd is $cmd\n";
system ($cmd);
}
}