Got it working!!!!  :)

Thanks to Mike, Nikola and Janek...

Have a wonderful day!!!

Mike


-----Original Message-----
From: Mike(mickalo)Blezien [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 9:04 AM
To: Michael Pastore
Cc: [EMAIL PROTECTED]
Subject: Re: deleting files


Hi Michael,

One way is to read the directory that you want to delete the files. This
works
very well for me:

my $DIR = '/path/to/folder';
my($deletefile,$removefile);

opendir (DIR, "$DIR") or die $!;
my @files = grep(/\.(dat|pl)/i,readdir(DIR));
closedir (DIR);


  foreach $removefile (@files) {
   $deletefile = $DIR . "/" . $removefile;
     unlink $deletefile if -e $deletefile;
   }


hope this helps :)


>>On Mon, 15 Jul 2002 08:48:12 -0400, Michael Pastore
<[EMAIL PROTECTED]>   wrote:

>>Just a quick question on deleting files in Perl.
>>
>>I am trying to delete some files in a directory, but I do not know their
>>names...just ending extension...
>>
>>I have tried:
>>
>>
>>One way:
>>
>>unlink <*.dat>;
>>unlink <*.p1>;
>>
>>Another way:
>>
>>unlink glob(".dat");
>>unlink glob(".p1");
>>
>>I have thought of popping out to the operating system as well, and
deleting
>>files as well, but would rather stay in Perl.
>>
>>Any help would be greatly appreciated..

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(985)902-8484
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

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

Reply via email to