Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

File find and samba share error

by ed1023 (Initiate)
on Jul 23, 2018 at 17:08 UTC ( #1219119=perlquestion: print w/replies, xml ) Need Help??

ed1023 has asked for the wisdom of the Perl Monks concerning the following question:

Good day kind monks, I seem to be having a problem with File:Find::name. In my testing on my local system

use strict; use warnings; use File:Find; use Data::Dumper; my $base_path = "."; sub dir_listing($) { my ($path) = @_; my @results; finddepth ( sub { return (-d); push @results, $File:Find:name; }, $path ); return sort @results; } print Dumper(dir_listing($base_path));

This code gives me a nice recursive directory listing. The problem I am having is then I try to use this code on network samba share. I get nothing listed. When I remove the return -d I get a listing of the top directories but the code does not seem to be recursing down the tree.

When I use ~$ find ~/samba/Videos/Movies -type f i get a full dir listing of files from the samba share so I am pretty sure my connection is working. I have tried using find2perl on my find command and the code it produces has the same problem .

Any comments would help I need something to jog my mind in a different direction. And thanks for your time.

Replies are listed 'Best First'.
Re: File find and samba share error
by haj (Chaplain) on Jul 23, 2018 at 17:43 UTC

    I've seen that behaviour for a samba share, too. A reasonable guess is to prevent File::Find from relying on the nlink counter:

    use File::Find; $File::Find::dont_use_nlink = 1;

    Apparently for network file systems File::Find fails to auto-detect whether it can rely on nlinks.

      Hi Haj,

      Thanks dont_use_nlink = 1 did the trick

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1219119]
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2019-11-18 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (91 votes). Check out past polls.

    Notices?