SPUG: Locating shtml files in multiple directories

Can Subaykan cansubaykan at hotmail.com
Thu Jul 18 10:39:55 CDT 2002

Hi Susanne,

check out the File::Find module


do something like this (not tested):

use File::Find;

my $dir = "/whatever/directory/you/want";
my @the_files;

find(\&get_shtmls, $dir);

sub get_shtmls {

   push @the_files, $File::Find::name if /\.shtml$/;

   # in here, $_ is the name of the file (something.shtml)
   # and $File::Find::name is the full path to that file
   # "/whatever/directory/you/want/and/further/inside/something.shtml


then you can do something with the array of filenames, or instead of 
building an array, you can open a log file and print the list to that file


----Original Message Follows----
From: "Sweethomes" <sweetsue at sweethomes.com>
To: "Seattle Perl User's Group" <spug-list at pm.org>
Subject: SPUG: Locating shtml files in multiple directories
Date: Thu, 18 Jul 2002 08:19:33 -0700

I know how to search for shtml files within one directory.  How would I do
this for all directories from the base directory out?


Susanne Bullo, Developer     Web Dev Design

MSN Photos is the easiest way to share and print your photos: 

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list