The Wayback Machine - https://web.archive.org/web/20090322122019/http://linux.about.com:80/od/emacs_doc/a/emacsdoc110.htm

Linux

  1. Home
  2. Computing & Technology
  3. Linux

Dired and Find

Emacs Documentation

By Juergen Haas, About.com

Dired and find

You can select a set of files for display in a Dired buffer more flexibly by using the find utility to choose the files.

To search for files with names matching a wildcard pattern use M-x find-name-dired. It reads arguments directory and pattern, and chooses all the files in directory or its subdirectories whose individual names match pattern.

The files thus chosen are displayed in a Dired buffer in which the ordinary Dired commands are available.

If you want to test the contents of files, rather than their names, use M-x find-grep-dired. This command reads two minibuffer arguments, directory and regexp; it chooses all the files in directory or its subdirectories that contain a match for regexp. It works by running the programs find and grep. See also M-x grep-find, in Compilation. Remember to write the regular expression for grep, not for Emacs. (An alternative method of showing files whose contents match a given regexp is the % g regexp command, see Marks vs Flags.)

The most general command in this series is M-x find-dired, which lets you specify any condition that find can test. It takes two minibuffer arguments, directory and find-args; it runs find in directory, passing find-args to tell find what condition to test. To use this command, you need to know how to use find.

M-x locate provides a similar interface to the locate program. M-x locate-with-filter is similar, but keeps only lines matching a given regular expression.

The format of listing produced by these commands is controlled by the variable find-ls-option, whose default value specifies using options -ld for ls. If your listings are corrupted, you may need to change the value of this variable.

* Emacs Manual Index

')}if(z155>0){w('
'+ap[0]+at[4]+as[0]);adunit('','','about.com',ch,gs,336,155,'1','ps',4);w('
')}

Explore Linux

Must Reads
By Category

More from About.com

Browse All About.com

Linux

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Software
  5. Editors
  6. Emacs
  7. Emacs Documentation - Dired and Find
Add to:

�2009 About.com, a part of The New York Times Company.

All rights reserved.