<SNIP, SNIP>
>>
>> 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.
>>
>
> glob returns the relative path of the files so if you are in a
> different
>  directory (other than c:/testdir) executing the script, it will not
> find  the files. try fully qualify the path:
>
> #!/usr/bin/perl -w
> use strict;
>
> open(FH,"listitems.txt") || die $!;
> unlink map{chomp; glob "c:/testdir/*$_*.*" } <FH> or die $!;
> close(FH);
>
> __END__
>
> or:
>
> [x]$ perl -lne 'unlink glob "c:/testdir/*$_*.*" or die $!'
> listitems.txt

This suggestion returned the error:

Died at testscript.pl line 4, <FH> line 15.

I tried both the suggested methods without success. But, I mightuv found a
problem.  I tried all of these methods with no success and looked at the
input file "listitems.txt" and found something interesting when using a
hexeditor.  Each line ends with 0D0A, so in a hex editor the previous file
looks like:

item9970D0Aitem9960D0Aitem9990D0Aitem9830D0A

but when I look at the file with notepad it looks like:

item997
item996
item999
item983

Could this be the culprit?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to