Vanson Samuel
Vanson Samuel

Reputation: 2089

Is there a function in Emacs to search the filesystem for a file by its name?

I want to open a file that is somewhere deep in my project tree. I know the name of the file, however I don't want to go searching the tree for it. I would like a way to enter just the file name, and have emacs search for me. I should also be able to enter the base directory I want to start the search from, and emacs should remember that for future searches.

Upvotes: 3

Views: 334

Answers (4)

Drew
Drew

Reputation: 30699

In Icicles you can find files by matching not just the relative file name but any parts of the path. You can use substring, regexp, and fuzzy matching. You can AND together multiple search patterns (progressive completion). See multi-command icicle-locate-file.

http://www.emacswiki.org/emacs/Icicles_-_File-Name_Input

Upvotes: 1

phils
phils

Reputation: 73274

M-x find-name-dired is the built-in solution for this. The default directory changes according to the current buffer, but the minibuffer history contains the previous selections.

Upvotes: 3

Trey Jackson
Trey Jackson

Reputation: 74440

I happen to like the ifind.el package which can be downloaded from the emacswiki here.

Upvotes: 2

Alex
Alex

Reputation: 65952

Sounds like you are looking for the equivalent of Textmate's Command-T functionality. The closest I have found for emacs is find-file-in-project. It can be bound to C-t or a similar key for convenience: (global-set-key "\C-t" 'ido-find-file-in-tag-files)

Upvotes: 3

Related Questions