$File::Find

Discussion in 'Perl' started by Pierre-Yves, Aug 16, 2004.

  1. Pierre-Yves

    Pierre-Yves Guest

    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 !
    Pierre-Yves, Aug 16, 2004
    #1
    1. Advertising

  2. Pierre-Yves

    Guest

    "Pierre-Yves" <pyu-at-belbone.be> wrote in message news:<41206af8$0$293$>...
    > 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.
    , Aug 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Hansen
    Replies:
    6
    Views:
    406
    Peter.....
    Sep 29, 2004
  2. Wybo Dekker
    Replies:
    1
    Views:
    337
    Yukihiro Matsumoto
    Nov 15, 2005
  3. nani
    Replies:
    2
    Views:
    153
    comp.llang.perl.moderated
    Mar 14, 2008
  4. vdvorkin
    Replies:
    0
    Views:
    388
    vdvorkin
    Feb 10, 2011
  5. vdvorkin
    Replies:
    3
    Views:
    793
    vdvorkin
    Feb 14, 2011
Loading...

Share This Page