[Kc] getting all file paths

jay jyoung79 at kc.rr.com
Fri Mar 23 17:43:33 PDT 2007

Hi Doug,

Thanks for taking the time to reply as well as sharing these  
examples.  This helps greatly!!  :-)

Thanks again!


 >At 09:08 PM 3/22/2007, you wrote:
 >>I'm trying to figure out how to find out more about File::Find (like
 >>what -d does (I'm assuming it means directories), etc).

 >I don't quite understand what information you're wanting to get about
 >each file but maybe this information will help:

 >Variable $File::Find::dir is the full path only to the file
 >Variable $File::Find::name is the full path and filename
 >Variable $_ is just the file name

 >Yes, you were correct that the "-d" test will determine if the file
 >is a directory.  There are several other file tests also.

 >I don't know if this would help but instead of excluding the files
 >you don't want to see maybe you could only include the files that you
 >do want to see.  For example:

 >#!/usr/bin/perl -w

 >use File::Find;

 ># only display .mp3 files
 >find(sub { if ($_ =~ m/\.mpg$/i) { print "$File::Find::name\n" } },
 >"/Users/jay/Desktop/song files/");

 >>Also, is there a limit as to how many files you can find?  Does it
 >>just depend on how much memory your machine has?

 >I suppose you could run out of resources if you wrote the script
 >right but generally speaking I think it returns one file at a time so
 >I don't think there's a problem with memory.

 >I hope this helps!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070323/5189cc7f/attachment.html 

More information about the kc mailing list