Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Search filesystem with a wildcard
Date: Sun, 27 Feb 2011 19:33:37
Message-Id: AANLkTi=u5X_g+Dca1cvCVqgZi4k7Cb1ONE6hjE1t63ui@mail.gmail.com
In Reply to: Re: [gentoo-user] Search filesystem with a wildcard by Stroller
1 >> I can't get find to work.  This works:
2 >>
3 >> locate *foo*.txt
4 >>
5 >> but none of these work:
6 >>
7 >> find /my/folder -name foo*.txt
8 >> find /my/folder -name *foo*.txt
9 >> find /my/folder -type f -name '*foo*.txt'
10 >
11 > $ mkdir -p  /my/folder
12 > mkdir: cannot create directory `/my': Permission denied
13 > $ mkdir -p my/folder
14 > $ touch my/folder/foo.txt
15 > $ find my/folder -type f -name '*foo*.txt'
16 > my/folder/foo.txt
17 > $ find /my/folder -name foo*.txt
18 > find: `/my/folder': No such file or directory
19 > $ ^/^
20 > find my/folder -name foo*.txt
21 > my/folder/foo.txt
22 > $
23 >
24 >> What am I doing wrong?  I do need the find to be recursive in that folder.
25 >
26 > IMO the first thing you're doing wrong is concealing from us what you're actually doing.
27 >
28 > You're telling us that `find /my/folder -name foo*.txt` and two other versions don't work, yet you're relying on us taking your word on it that they don't.
29 >
30 > Prove it!
31 >
32 > You could have done exactly as I did above and create a folder called "my/folder" and created a file called foo.txt and then copied and pasted from the terminal to show us your actual commands.
33 >
34 > So we are only left to guess that the file you're looking for is NOT actually called "foo.txt" and it's NOT actually in a folder called "/my/folder". So the problem could be that you're looking for a file with a capital letter in its name, and that you're  using "-name" instead of "-iname", or it could be that you're searching the wrong directory tree, or it could be a bunch of other things. Permissions springs to mind.
35 >
36
37 Yes, if I had posted the real stuff you would have been able to tell
38 me to use -wholename instead of -name to mimic mlocate functionality.
39
40 > But you'd rather waste our time in trying to conceal what you're looking for (I can only assume the file is called "Busty big sluts 3.avi") than help us help you.
41 >
42
43 I don't lose track of my Busty big sluts 3 AVI thank you very much.
44
45 - Grant
46
47 > Stroller.