TIP: Click on subject to list as thread! ANSI
echo: linuxhelp
to: Randall Parker
from: Tim Boyer
date: 2006-12-21 07:27:46
subject: Re: Recursive ls on book...?

From: Tim Boyer 

On Wed, 20 Dec 2006 20:38:46 -0800, Randall Parker

wrote:

>John Beckett wrote:
>> You've had some informative replies, but they have not mentioned one vital
>> point. If Unix had a 'dir /s' command, the above would still not do what
>> you want because Unix has no concept of a file extension.
>
>Suppose one wants to find, say, book*.html. How hard is it to do that?
>

Easy.  Works the same way.

[root{at}melbourne www]# find . -name *index*.html -print

./internal.denmantire.com/calendar/includes/index.html
./www.coreyboyer.org/work/denman/index.html
./www.timboyer.org/index.html

>> The pattern book*.*
>> matches only file names starting with 'book' AND
>> that contain a period (".") after 'book'.
>>
>> As was mentioned, you need pattern book* (no period).
>
>So find is the command to use unless you have an up-to-date database for
>locate?
>

Yeah.  I just run locate in a nightly cron job.  Locate actually keeps a
database of files, so it's much, much faster.

/usr/bin/updatedb -f "nfs,smbfs,ncpfs,proc,devpts" -e
"/tmp,/var/tmp,/usr/tmp,/afs,/net"

>> The action "-print" is usually the default, so the equivalent of
>> DOS 'dir /s book*.*' is
>> find . -name "book*"
>
>This seems verbose. But the -name applies to what comes after it, right?
>So how could one create an alias or script that would just take a path
>and a string? e.g.:
>
>ff . "book*"
>

#!/bin/bash

find $1 -name $2 -print|more

--
tim boyer
tim{at}denmantire.com

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.