On Wed, Aug 01, 2001 at 10:08:13AM -0700, Greg Tomczyk wrote:
> 
> Thank you for the response. I must confess that I have been reading the
> Perldocs, but I am having some logic troubles, difficult to understand how
> to use File::Find.  I tried using the push routine, but that listed all
> files instead of only listing all files that have "domain.com".

find() is pretty simple; you give it a subroutine and a list of directories,
and it recursively finds files in those directories and calls the subroutine
for each file (remember, directories are files too).

    my @files;
    find(\&wanted, "...");

    sub wanted {
        if (match criteria goes here) {
            push(@files, $File::Find::name);
        }
    }



> If I change code back to print("$name\n"); It will list only files found
> that meet grep criteria.

The code you have, with the correction I showed you, will push onto @files
only those files that match.


> I would much rather do the whole thing in straight perl, but I need
> the find to recursively search directories and not cross filesystems or
> links, as well as tell me the names and locations of files.

File::Find::find is straight Perl, and does exactly what you need.


> To cleanup the routine exec, I am not sure how to do it, and have it do
> what I want.

As I said, simply replace it with a call to system() and check the return
value.  That is largely what the find2perl doexec() is already doing, but it
has extra code in there for handling {} and -ok.


I'm trying, possibly vainly, to explain everything from a broad perspective. 
Your questions don't really include anything specific that can be explained.
If you could look through the code being used, and try to point out things
you're confused about, this list could help you better.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to