Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: rename files

by talexb (Canon)
on Aug 08, 2005 at 13:44 UTC ( #481876=note: print w/replies, xml ) Need Help??

in reply to rename files

How about adding or die "Unable to rename $number.gif to $numbers_replace.GIF: $!" to your last line so we can find out why it's failing?

Once you know what the problem is, you can address that.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: rename files
by Anonymous Monk on Aug 08, 2005 at 13:54 UTC
    the error print unable to find file. the file does exist with correct file permission

      That rather backs up Fletch's theory. You need to put the directory name back onto the filenames before trying to rename them.


      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

      OK, now we're getting somewhere. Is it unable to find the source file, the first file? I expect that's the case, since you're trying to create the destination file.

      Are you checking that the file exists as the same user? That is, are you running the script from a prompt or is it a CGI or something run from cron?

      The reason I'm asking is that the script is not able to see the file, while you are. The script isn't lying -- it really can't see the file. If you can see the file, then you must be looking at a different system or running with different privileges.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        by stating the file location i have a new error "Argument "" isn't numeric in addition (+)". with relation to the $number_replace variable? i am running the script from a command line the directory and files are now chmod 777 (wromg i know) and the script is chmod a+x

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://481876]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-04-25 07:51 GMT
Find Nodes?
    Voting Booth?