Alright.. I got bored.
make a perl script somewhere on your server with the following in it:
#!/usr/bin/perl
# Renames stuff..
#
my $fn = $ARGV[0];
$fn =~ m/(.+[^\d])(\d+)\.(.+)/;
my $newfn = sprintf("%s%03d.%s",$1,$2,$3);
unless ($fn eq $newfn) {
`mv $fn $newfn`;
print "Moved $fn to $newfn\n";
} else {
print "skipped $fn\n";
}
then run something like:
find /home/phil21/gfyhelp -name \*.txt -exec /home/phil21/gfyhelp/rename.pl {} \;
(all on one line)
replace /home/phil21/gfyhelp w/ whatever directory you want to rename files in. change \*.txt to \*.jpg or whatever. If you have multiple extensions just run it multiple times, or make your own wildcard whatever. I just always, always have some form of control there out of habit. Saved my ass a few times.
and change /home/phil21/gfyhelp/rename.pl to the full path of wherever you put the perl script pasted above.
This will change any files to be 3 digits (1 to 001 21 to 021, 100 will stay the same, etc.), and output what it did. It works on any files that have digits before the dot, and at least one non-digit before those digits. (123something1.jpg would match, for example)
Shrug. works fine here. It's recursive and output is something like:
skipped /home/phil21/gfyhelp/foobar003.txt
Moved /home/phil21/gfyhelp/foobar3.txt to /home/phil21/gfyhelp/foobar003.txt
Moved /home/phil21/gfyhelp/recurs/foobar1.txt to /home/phil21/gfyhelp/recurs/foobar001.txt
Moved /home/phil21/gfyhelp/recurs/foobar3.txt to /home/phil21/gfyhelp/recurs/foobar003.txt
skipped /home/phil21/gfyhelp/foobar001.txt
skipped /home/phil21/gfyhelp/foobar002.txt
Moved /home/phil21/gfyhelp/foobar6.txt to /home/phil21/gfyhelp/foobar006.txt
will skip any files that source/dest are the same (if the digits don't need to be padded basically).
I would suggest copying your dir tree in full, and running this over that. Then once you look over to make sure it's correct putting on your live stuff.
-Phil