in reply to Copying files

Untested but:
#!/usr/bin/perl open(GG,"getall.txt"); $dest="/home/test/files/"; $targ="/home/new/newfiles/"; while (<GG>) { ($first,$second,$third)=split(/\./,$_); print "first: $first second: $second third: $third \n"; my $dest_file = $dest . $_; my $target_file = $targ . "gotit.$second.$third"; system (`cp $dest_file $target_file`); } close(GG);
since $dest is a directory you are getting the error as that is your first argument passed to cp. -Enlil

Replies are listed 'Best First'.
Re: Re: Copying files
by Enlil (Parson) on Sep 26, 2002 at 19:31 UTC
    I meant to put a chomp in there also so it should read:
    #!/usr/bin/perl open(GG,"getall.txt"); $dest="/home/test/files/"; $targ="/home/new/newfiles/"; while (<GG>) { chomp; ($first,$second,$third)=split(/\./,$_); print "first: $first second: $second third: $third \n"; my $dest_file = $dest . $_; my $target_file = $targ . "gotit.$second.$third"; system (`cp $dest_file $target_file`); } close(GG);
    -Enlil
      File::Copy? It saves hassle at least... Mark