Gentoo Archives: gentoo-user

From: Roman Zilka <zilka@×××××××.cz>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Search filesystem with a wildcard
Date: Sat, 26 Feb 2011 22:05:17
Message-Id: 20110226224517.81a3687e.zilka@fi.muni.cz
In Reply to: Re: [gentoo-user] Search filesystem with a wildcard by Grant
1 > >> I used to use slocate like this to search the filesystem for a file:
2 > >>
3 > >> foo*.txt
4 > >>
5 > >> but mlocate doesn't seem to accept wildcards.  I tried to figure out
6 > >> how to do it with find but failed.  Can anyone point me in the right
7 > >> direction?
8 > >>
9 > >> - Grant
10 > >
11 > > How about this?
12 > >
13 > > find -name foo*.txt ?
14 >
15 > I can't get find to work. This works:
16 >
17 > locate *foo*.txt
18 >
19 > but none of these work:
20 >
21 > find /my/folder -name foo*.txt
22 > find /my/folder -name *foo*.txt
23 > find /my/folder -type f -name '*foo*.txt'
24 >
25 > What am I doing wrong? I do need the find to be recursive in that folder.
26
27
28 Don't you have some unfortunate alias set up for 'find'? I understand
29 you already have a working solution, but something's fishy here indeed.
30 The third one should absolutely work.
31
32 By the way, you should probably use quotes with 'locate' too. It might
33 cause the same kind of unexpected fail in case there happens to be
34 something which satisfies *foo*.txt in the working directory of the
35 command.
36
37 -rz