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?


In reply to Renaming multiple files with unique identifiers by reedkm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.