psqq
psqq

Reputation: 963

How to find folder in VS Code?

I have a project with a lot of files and folders. There are no problems with finding files. They can be found with Ctrl-P. But there are many folders in which files with the same name are made. Therefore, it is easier to search for a file by the name of the folder in which it is located. How in VS Code to search for folders in the current open project?

For example, I have the following project structure:

A/
    main.js
B/
    main.js
...
Z/
    main.js

The file main.js from the folder P will be easier to find by the folder name.

Upvotes: 56

Views: 76482

Answers (9)

Raz Luvaton
Raz Luvaton

Reputation: 3790

It's called Advanced tree navigation, You can filter the currently visible files in the Explorer view. With the focus on the Explorer view, press Ctrl+Alt+F (Cmd+Alt+F on macOS) to open the Find control and type part of the file name you want to match.

See more in VSCode docs - Advanced tree navigation

Example

Upvotes: 3

Youssef Oubrik
Youssef Oubrik

Reputation: 61

The Search Folders extension is perfect for this:

  1. Install the extension: Search Folders.
  2. Open the Command Palette (Ctrl + Shift + P) and type "search-folders".
  3. Enter the folder name, press Enter, and it will focus on the folder in the file explorer.

Upvotes: 2

StarLord
StarLord

Reputation: 1003

Click on any file/folder in the explorer. Then press Ctrl + F. A search bar will come up in the explorer and you can search for the file you want.

Upvotes: -2

gxmad
gxmad

Reputation: 2230

You can simply select a folder on the explorer and tape some filter keywords.

Recently, vscode added a shortcut, if you are using a recent release just typing won't work, first tape ctrl + f.

enter image description here

Upvotes: 11

Ivan Doroshenko
Ivan Doroshenko

Reputation: 1

It's simple. Just open the parent folder of your folder in VSCode. Then right-click on the folder you want to find subfolder in and choose "Find in folder"

Upvotes: -2

Lucas Emerick
Lucas Emerick

Reputation: 902

While using Ctrl-P, you can type the full path of the file, so if i have two files named bar you can search on Ctrl-P with "foo/bar" or with "qux/bar" Vscode uses fuzzy search (like so many others), so you don't have to actually type the whole thing. There is no way, to my knowledge and research, to find and be directed to a specific directory.

Upvotes: 32

Georgy Martynovich
Georgy Martynovich

Reputation: 533

I found a way to search through subfolders. Click on a folder you wish to search, than / and start typing for a name of subfolder

Upvotes: 1

Semicorpus
Semicorpus

Reputation: 81

Ctrl + Shift + E

and start typing. You'll see your search on the top right corner of file explorer.

By default it does not filter by result but your focus will jumps to the first one. From there you can Enter to open it.

If you want to show only results containing the string of search : click on filter icon next to your search (state will be remembered).

Echap

to exit/remove search or

Ctrl + Shift + E

again to switch back focus to last place you were typing.

Upvotes: 8

Janac Meena
Janac Meena

Reputation: 3587

This VSCode extension does exactly what you're asking for.

https://marketplace.visualstudio.com/items?itemName=rwu823.open-folder

Upvotes: 5

Related Questions