Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find-file recursively in directories

Tags:

emacs

Often, I know the file name but don't remember or find it cumbersome to specify the exactly directory. I'd like to be able to do:

find-file x/y/*/some_file.txt

where * would allow searching in recursive directories instead of just the current one.

like image 879
Vijay Kotari Avatar asked Sep 26 '13 23:09

Vijay Kotari


People also ask

What is a recursive file search?

Alternatively referred to as recursive, recurse is a term used to describe the procedure capable of being repeated. For example, when listing files in a Windows command prompt, you can use the dir /s command to recursively list all files in the current directory and any subdirectories.


2 Answers

As described here:

M-x find-name-dired 

After you provide the directory and the pattern the matching files will be displayed in a Dired buffer. You can navigate the file list (C-n, C-p, etc.) and open files as you wish (Ret).

like image 174
pink-potato Avatar answered Sep 21 '22 08:09

pink-potato


I've long looked for that feature and I'm now satisfied with what I found: I'm using helm-projectile.

Projectile is a project interaction library. Projects are VCS directories or directories containing a .projectile file. It is based on GNU find (but offers a pure emacs lisp implementation too)

https://github.com/bbatsov/projectile

(you can install it with packages.el). You can use it alone: call projectile-find-file (or projectile-mode and C-c p f). It uses ido for the completion by default, but in that case I prefer the interface of helm-projectile.

My colleagues kept telling me to use Sublime Text because of that feature. Fortunately, I found projectile :)

like image 32
Ehvince Avatar answered Sep 22 '22 08:09

Ehvince