Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: File::find and skipping directories

by sacked (Hermit)
on Jun 03, 2004 at 15:49 UTC ( [id://360218]=note: print w/replies, xml ) Need Help??


in reply to Re: File::find and skipping directories
in thread File::find and skipping directories

I suggest explicitly checking for a directory named '/home' to allow it:
if (-d && $uid < 500 and $File::Find::dir ne '/home'){

Aside, your status message is redundant:
print "UID is $uid, skipping $File::Find::dir, $File::Find::name, +$_\n"; __END__ UID is 0, skipping /home/zackse, /home/zackse/.kde, .kde
You can simplify this to:
print "UID is $uid, skipping $File::Find::name\n"; __END__ UID is 0, skipping /home/zackse/.kde

Remember that inside the wanted subroutine (offenders in this case), $_ contains the basename,$File::Find::name contains the full path, and $File::Find::dir contains the current directory.

--sacked

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found