Still having problem with unlink. My original problem began with deleting
files from a list. I seem to have fixed the problem reading the list but
the unlink does not work.
Here is the test script that I am working from:
my $file = 'listitems.txt';
open my $fh, $file or die "Cannot open $file: $!";
while($Line = <$fh>) {
chomp($Line);
my $del = "*$Line*.*";
my $complete = "c:/testdir/$del";
unlink glob $complete or die "unlink failed: $!";
}
A sample of the contents of the 'listitems.txt' file is:
item997
item996
item999
item983
The directory c:/testdir/ contains many files, but I want to delete the
files with any *item###*.* from the directory. So if the directory has
3000 files I want to delete every file that has item997 in it.
So file "testitem997document.txt" will be deleted as well as
"real1tem997file.doc" as well as "killitem983.txt.doc".
The sample script I posted aboveis returning the following error:
unlink failed: at testscript.pl line 7, <$fh> line 1.
Working in Windows XP and ActivePerl 5.8.0. BTW...this is perl.beginners
so be kind and understanding. :-)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]