Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: help needed in File::copy

by mickeyn (Priest)
on Mar 01, 2006 at 11:59 UTC ( #533629=note: print w/replies, xml ) Need Help??


in reply to help needed in File::copy

I didn't test it, but the destination file opening line in that module is:
open($to_h,"> $to\0") or goto fail_open2;
so it should override the file ...

Enjoy,
Mickey

Replies are listed 'Best First'.
Re^2: help needed in File::copy
by uva (Sexton) on Mar 01, 2006 at 12:25 UTC
    dear monks, copy("c:\\dir1\\text.errmsg", "c:\\dir2\\text.errmsg") || die "Can't open text.errmsg:$!"; when i ran the program, it creates the file and copied the content. next time i ran the program (destination file is existing now ) it is giving error message. Normally it should overwrite it ,but it is not happening here.. can u explain in detail??

      copy will check if the destination file exists. I don't think exists a parameter for overwrite destination file. Maybe you want this:

      unlink $destfile if -f $destfile; copy($origfile, $destfile);

      Update: This is a workaround. As mickeyn said at Re: help needed in File::copy, File::Copy should overwrite destination file.

      Igor 'izut' Sutton
      your code, your rules.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://533629]
help
Chatterbox?
[erix]: /hehehe
[marto]: LanX yesterday I found out about Gish gallop tactic
[marto]: "Eugenie Scott, executive director of the National Center for Science Education, dubbed this approach the Gish gallop, describing it as "where the creationist is allowed to run on for 45 minutes or an hour, spewing forth torrents of error that the
[marto]: evolutionist hasn't a prayer of refuting in the format of a debate." She also criticized Gish for failing to answer objections raised by his opponents"
[erix]: one would hope evolutionists haven't any prayers anyway

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-07-28 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (431 votes). Check out past polls.