#!/usr/local/bin/perl ############################################################################### # Reads bookname.nt file # Gathers files listed in bookname.nt and moves them to another # place. # # BEFORE RUNNING SCRIPT! # - create the /data/_e/calherim/bookname/figures directory # - explicitly change $bookname value at line 15 # # # 1996-09-12, CJC - California Heritage Project ############################################################################### print ("Please enter the bookname to run on\n"); $bookname = ; chop ($bookname); $ct = 0; # $bookname = "valley"; open (TABLE, "$bookname.nt") || die "Couldn't open file '$bookname.nt'.\n"; while ($line = ) { chop ($line); chop ($line); $name = $line . "B.jpg"; $newname = "/data/_e/calherim/$bookname/figures/$name"; # # Reads through files in directory. If filename is in table, # it gets renamed to corresponding $newname. # foreach $file (<*.jpg>){ if ($file eq $name) { $ct++; print "filename matched = $name, newname = $newname\n"; #print "$file matches\n"; rename ($file, $newname) } } # foreach } print "\n\n\n$ct image files moved\n\n\n";