reedkm has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I'm very novice, and have tried my hand at this problem:
I have 1000s of PDFs named arbitrarily and non-uniformly by a scanning vendor (nothing at all like the sample here). I need to rename them all with unique and uniform filenames.
I have the paths to all the files, and the metadata needed to uniquely name them. I thought I could create a Perl script that would use an array with the original filepath/name and an array with the new filepath/name to rename.
Thus far I have this:
#!/usr/bin/perl use warnings; use strict; use diagnostics; use File::Copy; # Set up arrays with original name and new name with unique ISBN my @IDI_name = ('I:\Production\TEST\P001.txt', 'I:\Production\TEST\P00 +2.txt'); my @PLL_name = ('I:\Production\TEST\ISBN_Text.txt', 'I:\Production\TES +T\ISBN2_Text.txt'); # Walk through array and copy with new filename foreach my $IDI_name (@IDI_name) { copy("$IDI_name", "$PLL_name"); }
The new name is giving me an explicit package name error, but I can figure out how to declare that variable.
So, is my approach entirely wrong?
How do I declare that variable?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Renaming multiple files with unique identifiers
by toolic (Bishop) on Aug 26, 2013 at 20:34 UTC | |
by reedkm (Initiate) on Aug 26, 2013 at 20:56 UTC | |
|
Re: Renaming multiple files with unique identifiers
by choroba (Cardinal) on Aug 26, 2013 at 20:35 UTC | |
by reedkm (Initiate) on Aug 26, 2013 at 20:53 UTC | |
|
Re: Renaming multiple files with unique identifiers
by hdb (Monsignor) on Aug 27, 2013 at 06:44 UTC |