Operating System - HP-UX
1753307 Members
6432 Online
108792 Solutions
New Discussion

command "find" -Option: -xdev / option perl File::Find

 
SOLVED
Go to solution
support_billa
Valued Contributor

command "find" -Option: -xdev / option perl File::Find

hello,

 

unix command find has following option:

find
 -- Option: -xdev
or
 -- Option: -mount
     Don't descend directories on other filesystems.  These options are
     synonyms.

 

we have a perl program and i can't find a Option , which do the same like "-xdev"

 

 use File::Find;
.....

# process is a procedure

 

 find({wanted => \&process,no_chdir => TRUE},$file_system);

 

i didn't find a option . does a option exist ?

 

regards

7 REPLIES 7
Dennis Handly
Acclaimed Contributor

Re: command "find" -Option: -xdev / option perl File::Find

>Option: -mount

 

There is no such option.  There are -xdev and -mountstop.

Tom Maloy
Respected Contributor

Re: command "find" -Option: -xdev / option perl File::Find

Try the "find2perl" command with the options that you want to use.

Carpe diem!
James R. Ferguson
Acclaimed Contributor

Re: command "find" -Option: -xdev / option perl File::Find

Hi:

 

As Tom suggested, leverage 'find2perl' to see how this can be done.  If you compare something like:

 

# find2perl /etc -print

 

...with:

 

# find2perl /etc -xdev -print

 

...you can see that the key is evaluating the stat() structure's device number.  The 'File::Find::topdev' variable holds the top directory's device number and find() skips objects that don't have the same device number.

 

Regards!

 

...JRF...

 

 

support_billa
Valued Contributor

Re: command "find" -Option: -xdev / option perl File::Find

hello,

 

i tried find2perl , but how i use i the perl script of author

 

"A. Clay Stephenson" How to find the greatest size file in certain mount point? ( it is in the attachment), also in the attachment "find2perl "

 

regards

James R. Ferguson
Acclaimed Contributor
Solution

Re: command "find" -Option: -xdev / option perl File::Find


@support_billa wrote:

i tried find2perl , but how i use i the perl script of author

 

"A. Clay Stephenson" How to find the greatest size file in certain mount point? ( it is in the attachment), also in the attachment "find2perl "

 


The suggestion for looking at 'find2perl' was to show how you implement the shell's find()'s '-xdev' option.  As I originally saidt the key is evaluating the stat() structure's device number.  The 'File::Find::topdev' variable holds the top directory's device number and find() skips objects that don't have the same device number.

 

You can modify Clay's script to include this if that meets your need; or write your own (to do what *you* want to do; or *not* use File::Find but rather use 'readdir()' to recursively descend a directory and examine and "do things" with its contents.

 

I would be appropriate if you provided some thanks and some feedback in the form of kudos for the help you have received in numerous threads, too.

 

Regards!

 

...JRF...

support_billa
Valued Contributor

Re: command "find" -Option: -xdev / option perl File::Find

hello,

 

thank you for your help, i try to change the perl code .

 

regards,

support_billa
Valued Contributor

Re: command "find" -Option: -xdev / option perl File::Find

with help i changed the perl code . it contains an new optional parameter "-xdev".

it works well , but a little bit slow for filesystem "/" , ux-command "find" is faster !

 

regards