in reply to Re: Re: Simple Multiple Folder Search Question
in thread Simple Multiple Folder Search Question

Another problem I've run into is how to differentiate between folders and files when scanning these folders. I noticed that when I started testing this script it would count the sub-folders in its listing of things older than 5 minutes. I'd like to ignore folders completely.
Is there some kind of regexp I can use in this
next if $File=~/^\./;
that would specify a folder to ignore? I'm looking all over for an answer to this and not getting anywhere. Thanks for any help.

Replies are listed 'Best First'.
Re: Re: Re: Re: Simple Multiple Folder Search Question
by matija (Priest) on Mar 22, 2004 at 21:16 UTC
    Regexp is not the right test for directory. Directories can have any name. You should use filetests:

    -f $file will return true if $file is a regular file.
    -d $file will return true if $file is a directory.

Re: Re: Re: Re: Simple Multiple Folder Search Question
by dkaplowitz (Novice) on Mar 22, 2004 at 21:25 UTC
    Thanks again matija, I seem to have had success using: next if (-d $File);

    I don't think I'll ever learn how to program. This stuff just seems to perpetually elude me.