#!/usr/local/bin/perl ############################################################################### # Reads tblmaken.tbl file which is created by running parse # script on tblmaken.txt which is exported from the database. # Renames files with contents of variables $oldname and $newname. # # oldfilename,newfilename # # 1995-11-13, CJC - California Heritage Project ############################################################################### open (TABLE, "cd988.tbl") || die "Couldn't open file 'tblmaken.tbl'.\n"; while ($line = ) { @list = split(/\,/, $line); $oldname = $list[0]; chop ($list[1]); $newname = $list[1]; print "$oldname gets renamed $newname\n\n"; # # Reads through files in directory. If filename is in table, # it gets renamed to corresponding $newname. # foreach $file (<*.jpg>){ if ($file eq $oldname) { #print "$file matches\n"; rename ($file, $newname) } } # foreach }