Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vifm search files in subfolders

How can I search files just like / command but recursively scanning subfolders. Or maybe there are other approach how can I get a list of files that match some pattern in current folder including all subfolders.

like image 383
bruce Avatar asked Aug 20 '15 14:08

bruce


People also ask

How do I recursively search a folder?

Using Find You can also use the find command followed by the target directory and the file you wish to locate. The command will start in the root directory and recursively search all the subdirectories and locate any file with the specified name.

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.

How do I find a folder in Vim?

Vim offers several commands for searching for files by name: :find, :sfind, :tabfind on the command-line, several normal-mode commands like gf, and others. If you just enter :find filename , Vim will directly open the first file found in your 'path' matching "filename".


1 Answers

:find command

There is :fin[d] command for that. Internally it invokes find utility (this is configurable via 'findprg' option), so you can do everything find is capable of. That said, in most cases the simple form of the command suffices:

:find *.sh

Note that by default argument is treated as regular file pattern (-name option of find), which is different from regular expressions accepted by /. For searching via regexp, use:

:find -regex '.*_.*'

If you want to scan only specific subfolders, just select them before running the command and search will be limited only to those directories.

:find command brings up a menu with search results. If you want to process them like regular files (e.g. delete, copy, move), hit b to change list representation.

Alternative that uses /

Alternatively you can populate current view with list of files in all subdirectories with command like (see %u):

:!find%u

and then use /, although this might be less efficient.

like image 180
xaizek Avatar answered Oct 01 '22 05:10

xaizek