The time now is Thu 26 Apr 2018, 11:22
All times are UTC - 4 |
Author |
Message |
dbd400@gmail.com
Joined: 26 May 2010 Posts: 31 Location: Silver Spring. MD 20901
|
Posted: Mon 22 Apr 2013, 09:16 Post subject:
How to make 'find' not search the Windows partition? Subject description: Solved |
|
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?
|
Back to top
|
|
 |
tallboy

Joined: 21 Sep 2010 Posts: 907 Location: Oslo, Norway
|
Posted: Mon 22 Apr 2013, 14:15 Post subject:
|
|
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.
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 4989 Location: Ontario
|
Posted: Mon 22 Apr 2013, 14:31 Post subject:
|
|
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.
_____________________________________
|
Back to top
|
|
 |
dbd400@gmail.com
Joined: 26 May 2010 Posts: 31 Location: Silver Spring. MD 20901
|
Posted: Mon 22 Apr 2013, 19:55 Post subject:
|
|
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!
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|