System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

find is searching only current working folder but not sub directories when using the option "-xdev"

SOLVED
Go to solution
senthil_kumar_1
Super Advisor

find is searching only current working folder but not sub directories when using the option "-xdev"

Hi All,

When using the below command, it is finding for files and folder with in current working directory only but not sub directories (recursively).

#find . -xdev -mtime +250 -exec rm -rf {} \;

At the same time if we use with out "-xdev" it is finding with in sub directories also.


How to solve this.
6 REPLIES
Tingli
Esteemed Contributor

Re: find is searching only current working folder but not sub directories when using the option "-xdev"

Wasn't there a similar question a few days ago?
James R. Ferguson
Acclaimed Contributor
Solution

Re: find is searching only current working folder but not sub directories when using the option "-xdev"

Hi:

The '-xdev' switch of find() tells 'find' not to cross (descend into) mountpoints other than the one from which it began.

The is very useful if you want to search '/' but do _not_ want to visit the mountpoints like '/usr', '/var', '/opt', etc. In that case, though, directories like '/etc' and 'sbin' _would be_ examined because they are _not_ mountpoints, just directories subordinate to the root '/'.

Regards!

...JRF...
Steven Schweda
Honored Contributor

Re: find is searching only current working folder but not sub directories when using the option "-xdev"

> How to solve this.

Non-psychics may have some trouble guessing
what's wrong, as we have no information on
"current working folder", or the file systems
on this system.

pwd
mount
James R. Ferguson
Acclaimed Contributor

Re: find is searching only current working folder but not sub directories when using the option "-xdev"

Hi (again):

By the way, you have a number of questions that you have asked during the last few days that remain unevaluated. Please don't forget to visit your profile, and review and evaluate them. Thanks.

Regards!

...JRF...
Steven Schweda
Honored Contributor

Re: find is searching only current working folder but not sub directories when using the option "-xdev"

> Wasn't there a similar question a few days
> ago?

Do you mean a question with nowhere near
enough information in it? There's one every
few minutes, or so it seems.
Tingli
Esteemed Contributor

Re: find is searching only current working folder but not sub directories when using the option "-xdev"