Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > File::Copy woes

Reply
Thread Tools

File::Copy woes

 
 
frisina@gmail.com
Guest
Posts: n/a
 
      12-10-2004
Hi all:


I am writing some code in which I want to copy a file to a directory
periodically, and replace the existing file of the same name when it
does indeed exist. Is there any way to do this with File::Copy? It
seems to not replace if the file exists.

Help?

Thank you,

Francis

 
Reply With Quote
 
 
 
 
James Tolley
Guest
Posts: n/a
 
      12-10-2004
> I am writing some code in which I want to copy a file to a directory
> periodically, and replace the existing file of the same name when it
> does indeed exist. Is there any way to do this with File::Copy? It
> seems to not replace if the file exists.


It replaces the file for me on XP, perl 5.8.3, File::Copy 2.07


 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      12-10-2004
<> wrote in message
news: ups.com...
> I am writing some code in which I want to copy a file to a directory
> periodically, and replace the existing file of the same name when it
> does indeed exist. Is there any way to do this with File::Copy? It
> seems to not replace if the file exists.


Your diagnosis is incorrect. File::Copy has no more trouble overwriting
an existing file than the cp system command. What is the error message
you are receiving? You *are* checking for the error message, aren't
you?

use File::Copy;
copy ('file.txt', 'otherdir/file.txt') or die "Cannot copy: $!";

As a hunch, I'd bet you don't have the needed permissions on the target
to overwrite the file.

Paul Lalli

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network Bridge woes Broady Wireless Networking 0 05-12-2005 11:15 AM
Wireless Connection Woes Frenchy Wireless Networking 4 11-04-2004 04:45 PM
adhoc network 11g wireless dropout woes dkh Wireless Networking 1 08-02-2004 01:27 PM
MN-700 and HP Pavilion woes shasha Wireless Networking 0 07-31-2004 10:12 AM
java woes (win98se) and mozilla Tendril Firefox 1 10-19-2003 04:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57