Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Renaming Multiple Files with Different Names

by Feral_Akodon (Initiate)
on Nov 02, 2011 at 16:10 UTC ( #935435=note: print w/ replies, xml ) Need Help??


in reply to Re: Renaming Multiple Files with Different Names
in thread Renaming Multiple Files with Different Names

I am just using the rename function in command line.

rename 001.tabular 3972

As I read your code, it is renaming the files by simply adding the extension of .foobar to each one. I need to completely rename them, so I need to designate $old as $ARGV[0] and $new as $ARGV1 from a text file but it needs to be the column and not the element of the array.

Even when the file doesn't exist, if I change the "%03d" it still says won't clobber. If I can fix that code to rename the files as the value of column 1 that I am sorting on, I don't have to worry about the renaming code. But when I make changes to the code, I either get won't clobber or still get the exact same names as before (that have no meaning and need to be changed).


Comment on Re^2: Renaming Multiple Files with Different Names
Download Code
Re^3: Renaming Multiple Files with Different Names
by NetWallah (Abbot) on Nov 02, 2011 at 17:10 UTC
    This may achieve what you are trying to do. Your first column is "$key". If you want the files generated to use this, Just replace the corresponding line with:
    $file{$key}{sequence} = $key; # Old stuff was : sprintf '%03d +.tabular', $file{$key}{ID};

                "XML is like violence: if it doesn't solve your problem, use more."

      Perfect it worked. Thanks so much NetWallah!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2015-07-06 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls