Chris Zampese wrote: > > > From: "Chris Zampese" <[EMAIL PROTECTED]> > > > > Just wondering if anyone has any bright ideas on how to rename a file in > > Win98. I have tried the following... > > > > my $old="C:/sentslips/sentslipstemp.txt"; > > my $new="C:/sentslips/sentslips1.txt"; > > > > rename($old, $new);
rename($old, $new) or warn "Cannot rename '$old' to '$new' $!"; > > But no luck, the sctipt runs without errors (I am running with the -w > switch > > and use strict) > > I have also tried using File::Copy but it doesnt copy the last line of the > file. > My file is created by printing single lines into a text file as follows.... > open($MYFILE1, "+>> C:/sentslips/sentslipstemp.txt") > || die "can't open C:/sentslips/sentslipstemp.txt"; > > print {$MYFILE1} "$filename?$date\n"; > close (MYFILE1); > > This is inside a loop, so I end up with a file with (at the moment) 2-4 > lines like so... > Placing_Slip___This is the first?09-02-2002 > Placing_Slip___This is the second?09-02-2002 > > but when I copy or move the file like this... > > copy("C:/sentslips/sentslipstemp.txt","C:/sentslips/sentslips1.txt"); > > the new file would have one less line, > > any help would be hugely appreciated. Thanks again use File::Copy; open OLD, "< $old" or die "Cannot open '$old' $!"; binmode OLD; open NEW, "> $new" or die "Cannot open '$new' $!"; binmode NEW; copy( \*OLD, \*NEW ) or die "Cannot copy '$old' to '$new' $!"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]