Re: using FIle::Find::name if regex to filter

2003-06-24 Thread David Storrs
On Mon, Jun 23, 2003 at 09:14:25PM +0200, [EMAIL PROTECTED] wrote:
> hi, how can i use a real regex with this:
> 
> File::Find::name if -x?
> 
> the filetestops are working fine, but how can i filter things like
> .gz$? i tried many ways, but all failed. any idea? thanks!!
> 
> bye andreas

Andreas,

I'm not quite clear on what it is you want to do.  It sounds like you
want to use File::Find to run some code on all files in a particular
subtree, but you don't want to run the code on anything ending with
.gz.  If I'm correct, then you can do this:


#!/usr/bin/perl

use warnings;
use strict;
use File::Find;

my $start_dir = "top of your subtree goes here";
find( \&my_func, "$start_dir" );

sub my_func {
return if /\.gz$/;

# ...do whatever you want here...
}


--Dks

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



Re: using FIle::Find::name if regex to filter

2003-06-23 Thread John W. Krahn
[EMAIL PROTECTED] wrote:
> 
> hi, how can i use a real regex with this:
> 
> File::Find::name if -x?
> 
> the filetestops are working fine, but how can i filter things like
> .gz$? i tried many ways, but all failed. any idea? thanks!!

File::Find puts the current file name into $_ in the callback sub so if
want to see if a file name ends with '.gz' you don't have to use
File::Find::name.


John
-- 
use Perl;
program
fulfillment

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



using FIle::Find::name if regex to filter

2003-06-23 Thread magelord
hi, how can i use a real regex with this:

File::Find::name if -x?

the filetestops are working fine, but how can i filter things like
.gz$? i tried many ways, but all failed. any idea? thanks!!

bye andreas

-- 
.::Please visit my homepage::.
http://www.math55.de.vu

.::A very good JAVA site (worth a visit)::.
http://www.javaCore.de

.::Please visit the ANTI - TCPA homepage::. 
http://www.antitcpa.com

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