in reply to Re: find () command does not process all symlinks
in thread find () command does not process all symlinks

Hi Hippo (and other generous Monks...), it is a continuation of my previous request. i am attaching an example. please note that i tried changing the 'follow' option with 'follow_fast' which did not help or 'follow_skip' which offers only die or ignore possibilities that does not fit me. thanks, Yaron.

use File::Find; find({wanted => \&search_tcl_files, follow => 1},$directory);

Replies are listed 'Best First'.
Re^3: find () command does not process all symlinks
by hippo (Archbishop) on Apr 27, 2024 at 11:00 UTC

    I am sure that when you re-read the code which you have presented here you will realise at once that it is not an SSCCE. That is a shame for you because the problem (if indeed there actually is one) is in the code which you have chosen not to show us.

    Here is the sort of thing which you should have provided. Note that this demonstrates that the syntax in the 2 lines which you have shown works perfectly well.

    #!/usr/bin/env perl use strict; use warnings; use File::Find; use Path::Tiny; # Construct the tree my $dir = path('quux'); my $file = $dir->child('baz')->touchpath; link $file, $dir->child($_) for qw/foo bar/; # Run the iterator find ({wanted => sub { print "found $_\n" }, follow => 1}, $dir); # Clean up $dir->remove_tree;

    🦛

Re^3: find () command does not process all symlinks
by Marshall (Canon) on Apr 27, 2024 at 11:01 UTC
    This does not qualify as an example. What "example" means is code that we can independently run and see your problem on our machines.

    From Perl Doc - File::Find:
    follow_skip
    follow_skip==1, which is the default, causes all files which are neither directories nor symbolic links to be ignored if they are about to be processed a second time. If a directory or a symbolic link are about to be processed a second time, File::Find dies.

    follow_skip==2 causes File::Find to ignore any duplicate files and directories but to proceed normally otherwise.

    So, this looks worth a try:

    find({wanted => \&search_tcl_files, follow => 1, follow_skip=>2},$dire +ctory);

      Hi Marshall, it seems your suggestion works well! thanks, Yaron.