Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Find Files in specific Folder but Exclude Subdirectories

Expand Messages
  • Hans Witschi
    Hi Randal an Jon, I respectfully insist: I still DREAM of a switch in: find(sub {$name{$File::Find::name} = -f;}, @ARGV); For now I have a construction with
    Message 1 of 7 , Jul 25, 2009
    • 0 Attachment
      Hi Randal an Jon,

      I respectfully insist:

      I still DREAM of a switch in:

      find(sub {$name{$File::Find::name} = -f;}, @ARGV);

      For now I have a construction with "@exclude=("DIR")", which works well. But
      I don't like it...

      ...and I couldn't fall in love with Randal'solution

      eval {
      find sub {
      ...
      die "##done" if $we_want_to_ stop;
      ...
      }, @starting points;
      };
      die $@ if $@ and $@ !~ /##done/;

      because it didn't work.

      However, my point is: it is too complicated and too time consuming to list
      directories for exclusion.

      Why so much coding when it could be achieved much easier, having somewhere
      deeper in the perl machine code a stop switch like "stay" in the
      "$File::Find::name" module:

      find(sub {$name{$File::Find::name} = -f;}, @ARGV stay);

      Unimaginable no one had similar thougts so far on that.

      Hans


      On Tue, Jul 21, 2009 at 3:31 AM, Jon Reynolds <jonr@...> wrote:

      >
      >
      > merlyn@... <merlyn%40stonehenge.com> wrote:
      >
      > > Just throw an exception.
      > >
      > > eval {
      > > find sub {
      > > ...
      > > die "##done" if $we_want_to_ stop;
      > > ...
      > > }, @starting points;
      > > };
      > > die $@ if $@ and $@ !~ /##done/;
      > >
      > You never fail to let me know just how far away I am from being a perl
      > guru or a beginner, for that matter Randall. But I always get hopeful
      > the more your Greek begins to be readable.
      >
      > Jon
      >
      >


      [Non-text portions of this message have been removed]
    • merlyn@stonehenge.com
      ... Hans Why so much coding when it could be achieved much easier, having somewhere Hans deeper in the perl machine code a stop switch like stay in the
      Message 2 of 7 , Jul 26, 2009
      • 0 Attachment
        >>>>> "Hans" == Hans Witschi <hwitche@...> writes:

        Hans> Why so much coding when it could be achieved much easier, having somewhere
        Hans> deeper in the perl machine code a stop switch like "stay" in the
        Hans> "$File::Find::name" module:

        Hans> find(sub {$name{$File::Find::name} = -f;}, @ARGV stay);

        What would "stay" do again? Maybe I missed your original
        problem, because my solution aborts *all* crawling mid-stride, when
        you hit a particular place.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
        See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
      Your message has been successfully submitted and would be delivered to recipients shortly.