Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^5: A DWIM too far?

by QM (Parson)
on Jun 18, 2004 at 15:52 UTC ( [id://367975]=note: print w/replies, xml ) Need Help??


in reply to Re^4: A DWIM too far?
in thread A DWIM too far?

I think you misunderstood (at least, I hope I've understood :)

Rewriting rename to include the -i option (or -y option for Windoze) will not clobber an existing file (unless the underlying OS function has the same problem with the -i option, in which case we're all screwed.)

I tried my example out, and it seemed to work as I intended. I'm sure someone has come up with a more robust and useful version. I was just trying to show that it was possible.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^6: A DWIM too far?
by eric256 (Parson) on Jun 18, 2004 at 16:04 UTC

    The /Y operator on windows forces it to overwrite without confirmation /-Y forces confirmation and there is no documented way to force failure when a file exists already.


    ___________
    Eric Hodges
      I thought I got it to work under XP. Here on Win2K, I agree with you.

      Ah well, I think it's just broken across the board.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

      Don't use either?

      P:\test\data>type hello.dat Hello world P:\test\data>type goodbye.dat Goodbye cruel world P:\test\data>rename hello.dat goodbye.dat A duplicate file name exists, or the file cannot be found. P:\test\data>type hello.dat Hello world

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-20 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found