[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Listing Folders and Subfolders



At 4:18 PM -0500 9/10/99, Robert Sweeney @DG&Astl wrote:
>Hello,
>
> I was asked to provide a directory tree for a website I'm working on, so I
>created the following code, which worked. My question of the more
>experienced MacPerl programmers: Was there a better/faster way to do this?

I like File::Find for this kind of thing; here's a working example:

#
# ls.pl - droplet: list Folders and Subfolders
#
# Written by Rich Morin, CFCL, 199909

use File::Find;

$startdir = $ARGV[0]; #drag and drop "root" folder on droplet version.

$| = 1;

sub wanted {
     print ">>> $File::Find::name\n" if (-d);
}

find(\&wanted, $startdir);

printf("\nThat's all, folks...\n");
--
Rich Morin:          rdm@cfcl.com, +1 650-873-7841, http://www.ptf.com/~rdm
Prime Time Freeware: info@ptf.com, +1 408-433-9662, http://www.ptf.com
MacPerl: http://www.macperl.com,       http://www.ptf.com/ptf/products/MPPE
MkLinux: http://www.mklinux.apple.com, http://www.ptf.com/ptf/products/MKLP

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org