![]() |
$File::Find
Hello,
I have to loop recursively in directories to build a tree. Based on the directory name, I know I can skip some (i.e: the BACKUP ones) to improve the performances that are currently very bad : At the moment I use find(&listFolders, $entrypoint) In the sub "listFolders" I do $File::Find::name if -d && !/^.$/; It works but but it's terribly slow and since it's used in a CGI, I can't let the users wait several minutes each times. I tried to add "next if /\/BACKUP$/;" but it doesn't seems to work. here is how the directory structure looks like : /source/ /répertoire1 /répertoire11 /répertoire111 /BACKUP ... /répertoire12 /BACKUP /répertoire2 /répertoire21 /BACKUP ... ... If someone can help, I would really appreciate... I'm new at Perl and I'm not yet very familiar with this language. Thanks in advance ! |
Re: $File::Find
"Pierre-Yves" <pyu-at-belbone.be> wrote in message news:<41206af8$0$293$ba620e4c@news.skynet.be>...
> Hello, > > I have to loop recursively in directories to build a tree. Based on the > directory name, I know I can skip some (i.e: the BACKUP ones) to improve the > performances that are currently very bad : > > At the moment I use find(&listFolders, $entrypoint) > In the sub "listFolders" I do $File::Find::name if -d && !/^.$/; > It works but but it's terribly slow and since it's used in a CGI, I can't > let the users wait several minutes each times. > I tried to add "next if /\/BACKUP$/;" but it doesn't seems to work. It's not quite clear what you are asking but I suspect you want to say $File::Find::prune = 1 if $_ eq 'BACKUP'; Unfortunately the File::Find documentation doesn't go into much detail about the prune facility because (I suspect) when File::Find was written it was assumed that everyone was familar with the Unix find command. This newsgroup does not exist (see FAQ). Please do not start threads here. |
| All times are GMT. The time now is 05:28 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.