My guess is that File::Find vigorously protects you from doing what you want.

After closely inspecting your non-existent SSCCE and taking an enormous leap of intuition, here's an SSCCE with a couple of choices for what I think your non-existent SSCCE shows you want :)

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11159091 use warnings; use Path::Tiny; my $dir = path('a'); $dir->remove_tree; path('a/b/c')->mkdir; path('a/b/c/file.tcl')->touch; symlink 'b', 'a/sym1'; symlink 'c', 'a/b/sym2'; system 'echo from the system tree command to show file structure;tree' +; print "\n"; my @folders = 'a'; # FIXME set to base of folder(s) while( my $path = shift @folders ) { push @folders, grep -d, <$path/*>; print "$0: $_\n" for <$path/*.tcl>; } print "\n"; path('a')->visit(sub{/\.tcl$/ and print "Path::Tiny::visit: $_\n"}, {recurse => 1, follow_symlinks => 1} ); print "\n"; use File::Find; find ({wanted => sub {/\.tcl$/ and print "File::Find $File::Find::name +\n" }, follow_skip => 2 }, 'a');

which outputs:

from the system tree command to show file structure . `-- a |-- b | |-- c | | `-- file.tcl | `-- sym2 -> c `-- sym1 -> b 6 directories, 1 file ../2perltree.pl: a/b/c/file.tcl ../2perltree.pl: a/b/sym2/file.tcl ../2perltree.pl: a/sym1/c/file.tcl ../2perltree.pl: a/sym1/sym2/file.tcl Path::Tiny::visit: a/sym1/c/file.tcl Path::Tiny::visit: a/sym1/sym2/file.tcl Path::Tiny::visit: a/b/c/file.tcl Path::Tiny::visit: a/b/sym2/file.tcl File::Find a/b/c/file.tcl

This output was generated on an ArchLinux system. It's possible that Find::File for the OS on your (unspecified) system (OS/2 BSD4.2 RSX-11M MVS Multics etc) may behave differently.


In reply to Re: find () command does not process all symlinks by tybalt89
in thread find () command does not process all symlinks by ypreisler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.