Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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).

Replies are listed 'Best First'.
Re^3: Renaming Multiple Files with Different Names
by NetWallah (Canon) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935435]
and the pool shimmers...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2018-02-25 04:10 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (312 votes). Check out past polls.