pavanpvss has asked for the wisdom of the Perl Monks concerning the following question:
use File::Copy; my ($filetobecopied,$newfile); system('ls -lrt | tail -15 | grep working > temp.txt'); open(FH,"<temp.txt"); open(FH1,">final.txt"); while(<FH>) { my $line = $_; if($line=~/.*(L_.*)(\d{1})(\.txt)(\.working)/) { # print "$1 - $2 - $3 - $4 \n"; my $one = $1; my $two = $2; my $three = $3; my $four = $4; my $val = 1; #print "$one 1 $three \n"; my $append = "$one" . '1' . "$three"; print "========================================== \n"; print "$append \n"; $filetobecopied = $append; $newfile = "/u/mindspring/data/fulfillment/FSI/outgoin +g/ $append"; copy("$filetobecopied","$newfile") or die "File cannot + be copied."; # The path of the existing directory where the file L_push_201207191101.txt to be copied is /u/mindspring/data/fulfillm +ent/FSI/outgoing } }
The error i am getting is File cannot be copied. at ClientLogic.pl line 21, <FH> line 1. So, how can a file created from a perl script be copied in the destination folder ?
Thanks in advance Pavan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to copy a file in a perl variable to a directory
by choroba (Cardinal) on Jul 20, 2012 at 13:45 UTC | |
by hippo (Archbishop) on Jul 20, 2012 at 14:12 UTC | |
by rovf (Priest) on Jul 20, 2012 at 15:58 UTC | |
|
Re: How to copy a file in a perl variable to a directory
by 2teez (Vicar) on Jul 20, 2012 at 22:48 UTC |