Working on an app to scan user directories for various things using File::Find::find (e.g. parse /etc/passwd, and pass the home directory to an appropriate &wanted subroutine).
My problem is that some user home directories in /etc/passwd are symlinks (which I want to follow), but these accounts also contain multiple symlinks that I want to ignore. I know that File::Find::find's default behavior is to not follow symlinks but I can set {wanted => \&wanted ,follow=>1} to follow symlinks.
I have code in place that tests the /home/username directory, and if a symlink, adds follow=>1 to the File::Find::find call.
The general behavior I'm looking for is to follow any symlink to the user's login directory, but then switch to the default of not following symlinks while scanning the contents of the account.
I've tried setting $File::Find::follow=0 in &wanted if $File::Find::dir doesn't match the user login directory, but no luck at this point (could be my code).
Any sage advice about how to approach this problem? Thanks for any thoughts you may have and for your time reading this.First post.
In reply to symlinks when using File::Find::find by ibpap
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |