Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

How can I make File::Find skip over dirs to which I don't have permission?

by 23skiddoo (Sexton)
on Aug 31, 2000 at 01:49 UTC ( #30419=perlquestion: print w/replies, xml ) Need Help??

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

I am using File::Find to recursively search a set of directories, but I want to suppress errors--such as when I don't have permission to chdir() to a particular directory. By the time I'm processing the files/dirs with the subroutine, it's too late to test them.

Or do I need to roll my own?

Thanks!

Originally posted as a Categorized Question.

  • Comment on How can I make File::Find skip over dirs to which I don't have permission?

Replies are listed 'Best First'.
Re: How can I make File::Find skip over dirs to which I don't have permission?
by fundflow (Chaplain) on Aug 31, 2000 at 02:01 UTC
    Did you try -r -x ?

      OK, I'm getting the hang of this format--I guess instead of a preview per se, I have a lag time for editing....

      Anyway, in regards to using -r -x (or other tests), that will keep me from churning them through the subroutine, like so:

      find ( \&procfile, @DIRS ); sub procfile { return if ! -r -x; # do something to everything else here }
      But I am wondering how to keep Find::File from attempting to enter unpermitted subdirectories before they get processed by the subroutine.

      Prost!

      > (My apologies if I've munged the HTML. I'm new to Perl Monks and wish there were a preview option for submissions a la slashdot.) OK, I just RTFM. I see now. (I like to dive right in... :) ) Prost!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2021-04-21 11:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?