473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

$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 !

Jul 19 '05 #1
1 4051
"Pierre-Yves" <pyu-at-belbone.be> wrote in message news:<41*********************@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.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ralph Freshour | last post by:
I looked in the manual and searched the web but did not see a file find function that takes a wild card - I need to look for all files such as: $Array = FileFind('name_*.jpg'); And then I...
6
by: micha | last post by:
suppose i have 3 files: script.php somedir/include.php somedir/config.php 1. script.php includes include.php 2. include.php includes config.php, so the structure looks like a cascade now...
3
by: Greg Yasko | last post by:
Hi. Does anyone know if there's an equivalent of Perl's file::find module in Python? It traverses a directory. I've googled extensively and checked this newsgroup and can't find anything like it...
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
1
by: Dan Jones | last post by:
I'm writing a script to process a directory tree of images.  In each directory, I need to process each image and generate an HTML file listing all of the images and links to the subdirectories....
12
by: Xah Lee | last post by:
would anyone like to translate the following perl script to Python or Scheme (scsh)? the file takes a inpath, and report all html files in it above certain size. (counting inline images) also...
2
by: Arjen | last post by:
Hi, Can someone help me to update my XML file? This is what I have. XmlDoc.Load(MapPath("~/myFile.xml")); XmlNodeList oXmlUser = oXmlDoc.GetElementsByTagName("user"); foreach (XmlNode user...
3
by: mouac01 | last post by:
Newbie here. How do I do a find and replace in a binary file? I need to read in a binary file then replace a string "ABC" with another string "XYZ" then write to a new file. Find string is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.