#!/opt/gnu/bin/perl # # Open a file containing two columns: # # 1. The desired file name and, # 1. The current file name. # # Read down the file, rename each file (actually, just put in a # link), and update all cross-references to that file in the # entire set of files. # use Cwd; $cwd = cwd() ; use lib $cwd ; use BOOKSTUFF ; open(DB,$dbfile) || die "Couldn't open $dbfile: $!\n" ; while ( ) { next if ( /^#/ ) ; # "#" at the beginning of the # line is a comment character. ($newname,$oldname,$start_page,$end_page) = split ; print " oldname=$oldname\n" ; # Rename the old file to the new file name # system( "mv book/$oldname.html book/$newname.html" ) ; # Change all of the references to the old name to the # new name. # system( "perl -pi -e 's|\\b$oldname\\b|$newname|g' book/*.html" ); }