in reply to problem in outputting files to a new directory

Huh? Where has the OP code gone?

Just a something something...
  • Comment on Re: problem in outputting files to a new directory

Replies are listed 'Best First'.
Re^2: problem in outputting files to a new directory
by ww (Archbishop) on Aug 27, 2009 at 10:58 UTC
    Original question (code tags fixed):

    I am trying to output the file to a new directory ( the files to be modified is in another folder) but i am getting the error cannot open directory

    My code:

    #!/usr/local/bin/perl -w # use strict; # use warnings; if($#ARGV != 1) { print "usage: perl directory.pl source direcoty detination direct +ory \n"; exit; } chomp(@ARGV); #my $dirname = "lab"; #my $output="lab2"; my $dirname = $ARGV[0]; my $output= $ARGV[1]; $dirname =~ s/\/$//g; $output =~ s/\/$//g; mkdir $output if (-d $output ==0); #`rm $output/*.lab`; opendir(DIR, $dirname) or die "can't opendir $dirname: $!"; while (defined($file = readdir(DIR))) { $file2=$file; $input=$dirname."/".$file; $out=$output."/".$file2; print $file."\t".$input."\t".$out."\n"; open(F,"<$input") or die " Cannot open file $input: $!"; open(F1,">$out") or die " Cannot open file $out: $!"; <F>; #while ($line = readline(F)) { #$line=~s/^(.*)\n$/$1/s; #$line=~ s/\r//gi; #print F1 $line ; #} close (F); close (F1); } closedir(DIR);