[X-Unix] Re: X-Unix Digest, Vol 48, Issue 1
John Baltutis
baltwo at san.rr.com
Mon May 4 19:01:16 PDT 2009
On 5/4/09, Eric F Crist <ecrist at secure-computing.net> wrote:
> On May 4, 2009, at 12:02 AM, Rick Gordon wrote:
>
>> How would I do a recursive search that will provide a path to the
>> parent folder of a searched-for file?
>>
>> For instance, this command will find the file in a recursive search,
>> but it provides no information on the path to that file:
>>
>> (starting from a suitable starting place)
>> ls -Rl | grep "Bookmarks.plist"
>>
>> -rw-rw-rw- 1 mobile mobile 100934 May 3 20:37 Bookmarks.plist
>> -rw-rw-rw- 1 mobile mobile 143 Apr 30 22:12
>> Bookmarks.plist.anchor.plist
>> -rw-rw-rw- 1 root mobile 203551 Apr 9 09:00 Bookmarks.plist.bup
>>
>>
>> ... will find all instances of files with Bookmarks.plist in the
>> name, but does not provide any paths to the found files. How can I
>> get the path?
>
> You're going about this wrong. The ls command doesn't print path
> information, it's just a directory listing. You want to use the find
> command. So, here's the example I used. This example was run from my
> home directory.
>
> ecrist at Swordfish:~-> find . -name "*Bookmarks.plist"
> ./Library/Application Support/Versions/Bookmarks.plist
> ./Library/Safari/Bookmarks.plist
Alternatively, use the locate command-it's faster, since there's no searching
the computer, just the locate database:
locate "Bookmarks.plist"
More information about the X-Unix
mailing list