[Kc] getting all file paths

jay jyoung79 at kc.rr.com
Thu Mar 22 19:08:31 PDT 2007


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).  The below  
code seems to work on my mac, but I'm hoping someone here might tell  
me if I'm doing something wrong.  Basically, I want to get all the  
file paths (as well as any files in nested folders) in a folder I  
select.  I'd like to end up with a list of file paths, which won't  
include the paths to any of the directories as well as no .DS_Store  
files either.  The code below does this, but returns a string with  
all the paths:

-------------------------
#!/usr/bin/perl -w

use File::Find;

find(sub { if (!/^\./ && !-d) { 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?

Thanks.

Jay


More information about the kc mailing list