Tuna has asked for the wisdom of the Perl Monks concerning the following question:
I want the code to look for any directory(s) beginning with "questionable", and any directory(s) matching the date-range convention of yyyymm-yyyymm. I am using File::Find to recurse through the top-level directory. Here's my problem: I need to process files contained the directories/nfs/export/netflow/intermediate/ /nfs/export/netflow/intermediate/200101-200102 /nfs/export/netflow/intermediate/200103-200104 /nfs/export/netflow/intermediate/questionable-200101-200102 /nfs/export/netflow/intermediate/questionable-200103-200104 /nfs/export/netflow/intermediate/current@ /nfs/export/netflow/intermediate/previous@
differently than the files contained in:/nfs/export/netflow/intermediate/200101-200102 /nfs/export/netflow/intermediate/200103-200104
HOWEVER, the files contained in both the "questionable" directories and the "yyyymm-yyyymm" directories are named using the same convention./nfs/export/netflow/intermediate/questionable-200101-200102 /nfs/export/netflow/intermediate/questionable-200103-200104
This prints the contents of "intermediate", without recursion. Obviously, the subroutine, &get_good_int doesn't do any thing useful yet, but I want to make sure that I'm grabbing the correct files, first. From reading other posts re: File::Find, I think that it is wise to mention that I am on a machine running 5.003_26.#!/usr/local/bin/perl -w use strict; use File::Find; my $intdir = "/nfs/export/netflow/intermediate"; find(\&get_good_int, $intdir); sub get_good_int { chomp; next if ( $_ =~ /^unknown/); my @list = split; foreach my $file (@list) { print "My filename is: $file\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Find Question
by repson (Chaplain) on Mar 14, 2001 at 10:58 UTC | |
|
Re: File::Find Question
by buckaduck (Chaplain) on Mar 14, 2001 at 20:02 UTC |