🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189022

Re: Can Dired "find" ?

#189022
From: Kjartan Stefansson
Date: Mon, 06 May 1991 14:21
38 lines
1825 bytes
harelb@cabot (Harel Barzilai) writes:

>I know I can type "C-x d" and then give a regexp like "*foo*" ; but
>dired does this *within a given directory* There is an ugly "find"
>command I can barely use and don't understand well, which can look
>thru subdirectories, recursively.

I agree that the find command is ugly.  But once you understand it,
it's easy to use.  I have an alias in my .cshrc file as follows:

	alias search "find . -name ''\!*'' -print"

so when I type

	search '*foo*'

it prints out all occurrences of *foo*, searching recursively through
subdirectories.

>Is there a way to make dired to this, or does someone have code I
>could put into my .emacs?

If you want an emacs command for this, here is one.  It simply invokes
the find-command.  You can put this code in your .emacs file and bind
it to some appropriate key:

(defun my-find(REGEXP)
  "Finds and lists files matching REGEXP in current directory"
  (interactive "sEnter file pattern: ")
  (shell-command (concat "find . -name \"" REGEXP "\" -print")))

>Many thanks,

>Harel

Enjoy,

Kjartan				(stefan@cs.cornell.edu)
Technical Details
Message-ID: <1991May6.142147.29911@cs.cornell.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!wuarchive!mit-eddie!uw-beaver!cornell!stefan
References: <JBW.91Apr12233532@bigbird.bu.edu> <1991May6.055120.13435@dartvax.dartmouth.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,b0193c6c491ddd84
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-05-06 09:10:06 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!wuarchive!mit-eddie!uw-beaver!cornell!stefan
From: stefan@CS.Cornell.EDU (Kjartan Stefansson)
Newsgroups: gnu.emacs.help
Subject: Re: Can Dired "find" ?
Message-ID: <1991May6.142147.29911@cs.cornell.edu>
Date: 6 May 91 14:21:47 GMT
References: <JBW.91Apr12233532@bigbird.bu.edu> <1991May6.055120.13435@dartvax.dartmouth.edu>
Sender: news@cs.cornell.edu (USENET news user)
Organization: Cornell Univ. CS Dept, Ithaca NY 14853
Lines: 38
Nntp-Posting-Host: moot.cs.cornell.edu