B
b.milbrandt
I am trying to convert a unix shell script to perl, and I have having a
problem with the portion that copies files based on extension and renaming
them in the process. I only trying to copy files with a non-zero length.
Here is what I have so far.
$target is a command line parameter
$source is a command line parameter
opendir DH, "/$target";
foreach $file (readdir DH)
{ printf " the file name is %s\n", $file;
next unless $file =~ \/.abc$/ and !-z $name;
my $newfile = /$target//$file;
$newfile =~ s/\.abc$/.xyz/;
$filecount += 1;
}
problem with the portion that copies files based on extension and renaming
them in the process. I only trying to copy files with a non-zero length.
Here is what I have so far.
$target is a command line parameter
$source is a command line parameter
opendir DH, "/$target";
foreach $file (readdir DH)
{ printf " the file name is %s\n", $file;
next unless $file =~ \/.abc$/ and !-z $name;
my $newfile = /$target//$file;
$newfile =~ s/\.abc$/.xyz/;
$filecount += 1;
}