[tpm] Another Regex question - follow on question

Stuart Watt stuart at morungos.com
Tue Oct 23 16:55:26 PDT 2012


On 2012-10-23, at 2:32 PM, Chris Jones <cj at enersave.ca> wrote:

> My tests are working correctly, I don't try to delete directories.
> 
> My follow on question is how do you tell File:Find to skip the directory the script is called from.  I only want to delete files in the sub-directories.
> 
> I can test each file to see if it's directory is '.' but would seem somewhat inefficient?

String matching efficiency is probably a thousand times higher than file system accesses, so if I was you I really wouldn't worry about it. I tend to use no_chdir => 1 and $File::Find::name, but to skip everything in the base directory, probably checking to see if $File::Find::dir is the same as the base should be quick and effective.

All the best
Stuart


More information about the toronto-pm mailing list