thewalledcity has asked for the wisdom of the Perl Monks concerning the following question:
Well now the directories can contain spaces in the names which drives the find command nuts, so I decided to rewrite that functionality in perl. After getting the list of directories to look though, I am trying to use File::Find to count for 'class' subdirs. Unfortunatly, this code is not decending into subdirectories correctly. When I run the program the counter only gets to 3. I know for a fact that there are more than 3 of these subdiretories.
Anyone have any ideas on things to try?
my $ltotal = 0; foreach my $dir (@good_dirs) { chomp($dir); unless ($dir eq "") { File::Find::find({wanted => \&wanted}, "/mnt/$dir"); } } sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -d _ && /^class\z/s && $ltotal++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems using File::Find
by graff (Chancellor) on May 29, 2003 at 03:04 UTC | |
|
Re: Problems using File::Find
by TomDLux (Vicar) on May 29, 2003 at 02:30 UTC | |
by thewalledcity (Friar) on May 29, 2003 at 02:35 UTC | |
|
Re: Problems using File::Find
by BrowserUk (Patriarch) on May 29, 2003 at 03:03 UTC | |
|
Re: Problems using File::Find
by broquaint (Abbot) on May 29, 2003 at 09:35 UTC | |
|
Re: Problems using File::Find
by VSarkiss (Monsignor) on May 29, 2003 at 02:52 UTC | |
|
Obligatory reference to File::Find guide
by data64 (Chaplain) on May 31, 2003 at 01:35 UTC |