in reply to moving files from folder1 to folder2

I use this code to upload files via CGI, I know this works.
my $mode = "0755"; my $localfile = "$uploaddir/$filename"; # open a new file and transfer bit by bit from what's in the buffe +r open( SAVED, ">>$localfile" ); while ( my $bytesread = read( $remotefile, my $buffer, 1024 ) ) { print SAVED $buffer; } close SAVED; chmod $mode, "$localfile"; # or die "can't chmod: $!";
Do you think this will work for what the OP wanted? It tried hacking it to open two files and read from the original and write to the new one.
my $mode = "0755"; my $localfile = "$uploaddir/$filename"; my $newfile = "$uploaddir2/$filename"; # open original file open( SAVED, ">>$localfile" ); # open new file open( NEW, ">$newfile" ); # write the original file to the new filename while ( my $bytesread = read( $remotefile, my $buffer, 1024 ) ) { print NEW $buffer; } close(SAVED); close(NEW); chmod $mode, "$newfile"; # or die "can't chmod: $!";

Replies are listed 'Best First'.
Re: Re: moving files from folder1 to folder2
by sulfericacid (Deacon) on May 14, 2004 at 23:34 UTC
    "<castaway> just reply and say 'that was me'"

    This node was mine, by the way :) "that was me"! :)



    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid