How can I find a file, user owned by tree and group owned by tree? And how can I find a whole directory inside which files are owned by tree?
How can I find a file, user owned by tree and group owned by
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The File::Find module is a standard Perl module (i.e., it is available on all installations of Perl). You can use File::Find to go through a directory tree and search for the file you want.
To use, you create a
wantedsubroutine that parses the files, then have thefindsubroutine include thatwantedroutine in its call. TheFile::Findmodule is a bit klutzy because it was originally only meant to use for the find2perl command.Here’s some completely untested code. Notice that you do yucky stuff like using global variables and package variables. It’s one of the reasons I don’t like
File::Find.I wrote my own
File::FindcalledFile::OFindbecause it’s more object oriented. You can get that from here. It’s a bit easier to understand. (Again, completely untested):