> This works - i've tried it...
>
> print 'Deleted ' , unlink (<*997*>) , ' files.\n';
>
> good luck
> Duncan
Yes, it does. But it does not work when reading from a variable.
my $temp = '*997*';
print 'Deleted ' , unlink (<$temp>) , ' files.\n';
This very simple variation of your example does n
"Perlwannabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > This works - i've tried it...
> >
> > print 'Deleted ' , unlink (<*997*>) , ' files.\n';
> >
> > good luck
> > Duncan
>
> Yes, it does. But it does not work when reading from a variable.
>
> my $temp = '*997*';
> print '
"Perlwannabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> >>
> >> 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
>
Use the glob() function instead of <> for file globbing. Then you won't have
to worry about situations like the one you accidentally fell into.
--
Peter Scott
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
>>
>> 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
> diff
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:
> On Fri, 8 Aug 2003 22:16:38 -0400 (EDT), perlwannabe wrote:
>> 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 hexed
Perlwannabe wrote:
> 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 $f
In my zeal for making things simple I may have created a problem. OK,
here is the lowdown:
the real file names I am trying to delete from the directory are rather
lengthy and complicated and look like:
partial_qn_ri_pub_default_asp__Online_qdisp_bn_03042997-0-0
partial_qn_ri_pub_default_asp__Onl
On Fri, 8 Aug 2003 22:16:38 -0400 (EDT), perlwannabe wrote:
> 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.
In article
<[EMAIL PROTECTED]>,
perlwannabe <[EMAIL PROTECTED]> wrote:
[Snip]
> partial_qn_ri_pub_default_asp__Online_qdisp_bn_03042997-0-0
> partial_qn_ri_pub_default_asp__Online_qdisp_bn_03042995-0-0
> partial_qn_ri_pub_default_asp__Online_qdisp_bn_03042882-0-0
[Snip]
> So I tried to use the u
To all of you who helped me with my unlink problem...THANK YOU!!!
I finally figured out that the problem was the input file. There was an
extended ASCII character at the beginning of the file that could not be
seen until I looked at it with a hex editor.
I am learning the hard way. But now the
"Perlwannabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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 workin
.
- Original Message -
From: "perlwannabe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 08, 2003 7:16 PM
Subject: Re: Still need unlink help!! God help me.
>
> >>
> >> The directory c:/testdir/ contains many files, but I want to delet
On Sat, 9 Aug 2003 00:22:09 -0400 (EDT), perlwannabe wrote:
> I did indeed comment every single
> variable, but deleted it from my sample script for simplicity. I have
> been wrestling with this problem for a while. I did run your code and got
> the following error:
>
> C:\testdir>perl testfile.
15 matches
Mail list logo