How to make 'find' not search the Windows partition?

Booting, installing, newbie
Post Reply
Message
Author
dbd400@gmail.com
Posts: 31
Joined: Wed 26 May 2010, 18:35
Location: Silver Spring. MD 20901

How to make 'find' not search the Windows partition?

#1 Post by dbd400@gmail.com »

I am running slacko5.5 installed as a full install. My Windows partition is /mnt/sda3. I was trying to tailor a 'find' to search only the linux part of the file space. I know I can do that by unmounting sda3, but that is inconvenient very often. In constructing the 'find' it seemed to me that either one of 2 expressions ought to do the job: ' ... ! -name "/mnt/sda3* ..." or '... path "/mnt/sda3" -prune", but the one with -prune ought to run a whole lot faster. The full command line would look something like:
a. find / \( -name "xxx...xxx" -a ! -name "/mnt*" \) ..., or
b. find / \( -name "xxx...xxx" -a -prune "/mnt*" \) ... or
c. find / \( -path "/mnt*" -prune -a -name "xxx...xxx" \) ... or
d. find / \( -name "/mnt*" -a -name "xxx...xxx" \) or
e. find / \( ! -name "/mnt*" -o -name "xxx...xxx" \) or
f. find / -path "/mnt" -prune -o -name "xxx...xxx' ...

The results are:
a, b, c, d all include many files starting "/mnt...".
e did not try
f works properly

It seems to mean that, in general, one must know enough about the expression to be searched upon to know where in the path it occurs. Its as if one gets only one crack at the path of each file, despite the syntax, so one must sort ones expressions. If you have 2 search strings, A and B, both of which must be present, but in any sequence, you mist try them as '-name a -a -name B' and also as '-name B -a -name A' to make sure you haven't got past either one, which ,makes no sense. Yes, you could shorten it to '\( -name "*A*B" -o -name "*B*A" \)'. Does this make sense? I believe that expectation is flawed. What does anyone else think?

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#2 Post by tallboy »

From the find manual: (man find; query = filesystems)

-xautofs
Don't descend directories on autofs filesystems.

-xdev Don't descend directories on other filesystems.

-fstype type
File is on a filesystem of type type. The valid filesystem
types vary among different versions of Unix; an incomplete list
of filesystem types that are accepted on some version of Unix or
another is: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. You can
use -printf with the %F directive to see the types of your
filesystems.

-mount Don't descend directories on other filesystems. An alternate
name for -xdev, for compatibility with some other versions of find.

I hope you make it work.

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#3 Post by don570 »

Bulldog Finder allows a search just in one mounted partition.
This can be useful occasionally.

I put it in my right clicks package which is a must for Slacko users.


_____________________________________

dbd400@gmail.com
Posts: 31
Joined: Wed 26 May 2010, 18:35
Location: Silver Spring. MD 20901

#4 Post by dbd400@gmail.com »

Thanks, Tallboy. Although -xautofs failed in not getting any results, using -xdev gave perfect results on Slacko 5.5, full install, is easier to type, and needs no thinking, as mine does. (Of course, if one abandons all thinking, one deserves unthinkable results.) Thanks again!

Post Reply