Re: Recognizing Directories...

2002-09-17 Thread Peter_Farrar


>Hello Everyone,

>I am writing a utility that needs to index the files contained within
about 500 directories (some nested). I want to provide the >script with a
top directory and have it recurse through everything underneath while
indexing the files within each. I've searched >Google and can't seem to
find a way to do this. I know how to get all files within a directory but
how do I RECOGNIZE my >directories so I can descend into them to index?

>Thanks in Advance,
>Anthony Saffer


if (-d $val){
#do stuff
}

look out for long file names when globbing.




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




RE: Recognizing Directories...

2002-09-17 Thread Bob Showalter

> -Original Message-
> From: Anthony Saffer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 11:03 AM
> To: [EMAIL PROTECTED]
> Subject: Recognizing Directories...
> 
> 
> Hello Everyone,
> 
> I am writing a utility that needs to index the files 
> contained within about 500 directories (some nested). I want 
> to provide the script with a top directory and have it 
> recurse through everything underneath while indexing the 
> files within each. I've searched Google and can't seem to 
> find a way to do this. I know how to get all files within a 
> directory but how do I RECOGNIZE my directories so I can 
> descend into them to index?

You can test whether a filename is a directory with -d

   perldoc -f -d

But you should use the standard File::Find module to traverse directory
trees. It comes with the standard Perl distribution, so you've got it.

   perldoc File::Find

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




RE: Recognizing Directories...

2002-09-17 Thread Nikola Janceski

you should check out File::Find on CPAN.org.

> -Original Message-
> From: Anthony Saffer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 11:03 AM
> To: [EMAIL PROTECTED]
> Subject: Recognizing Directories...
> 
> 
> Hello Everyone,
> 
> I am writing a utility that needs to index the files 
> contained within about 500 directories (some nested). I want 
> to provide the script with a top directory and have it 
> recurse through everything underneath while indexing the 
> files within each. I've searched Google and can't seem to 
> find a way to do this. I know how to get all files within a 
> directory but how do I RECOGNIZE my directories so I can 
> descend into them to index?
> 
> Thanks in Advance,
> Anthony Saffer
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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