How can I remove folders from Visual Studio Code folder directory?
6 Answers
Just in case anyone else is looking for this - just use File > Close Folder. I think this is what the op was looking for?
Added by barlop
This no longer applies post Jan 2019, as serge's comment indicates, the option mentioned above is no longer there. Mathan's answer is the one to use now.
You might have to scroll down the file menu to see "Close Folder". 'cos sometimes the last option you see is "Close Editor", if the window isn't big enough,but scroll down and there's a few more options like "Close Folder", "Close Window", and "Exit".
And if no folder is open then "Close Folder" won't be in the option and then after "Close Editor" it goes straight to "Close Window",and "Exit". But if a folder is open then it'll be between Close Editor and Close Window.
-
6there is no such a command in the File menu (as for Visual Studio Code v1.30.2)– sergeJan 22, 2019 at 14:09
-
This doesn't apply anymore(as serge said). Mathan's answer is the one to use now– barlopMay 26, 2020 at 17:22
-
1You can still find that command in the command pallette as "Workspaces: Remove folder from workspace".– wortwartJul 15, 2020 at 10:57
-
I can still find and use this command from the file menu in VSCode 1.49.3. Did Microsoft team added it back? Oct 8, 2020 at 8:34
-
1
Hi I am also facing same issue.
Here is the solution. In the Workspace Explorer, right click on the folder you wish to remove and select "Remove Folder from Workspace" from the the popup menu. See images below.
-
-
Additional info: This only works for "main" folders that were added to the workspace! I just tried adding my "www" folder containing all projects in order to have an "all my own projects workspace". Then, I wanted to remove some of the subfolders (e.g. some downloaded github projects), which is not possible. Instead, I had to create a workspace and then add all the single projects/subfolders of the main "www" folder in order to create my "all own projects" workspace.– JanSep 7, 2021 at 12:39
Code is doing exactly what it is intended to do here.
The Working Files section lists the files you have either opened via a double-click in the Explorer pane or have opened another way and then edited. (See the docs.)
The HTDOCS
folder you've also circled is the folder you explicitly opened via File → Open, so of course that shows up.
The Explore view is clearly a reference to Windows Explorer, which just shows you the contents of the folder you have open. It is a live view: say mkdir foo
at the command line in the directory you have opened in Code, and a second or so later, foo
will appear in the Explore pane, if you have the folder's disclosure triangle twirled open. Just as Windows Explorer simply shows you what's present in the folder you have opened in it, so does Code Explorer.
I have found that the Explore pane doesn't pay attention to the OS's "hidden" file attribute. It also doesn't ignore dot files. But, this is the sort of thing you expect for a 0.1.0 product. I have filed a bug for this issue; please vote on it if you care about this.
-
This doesn't answer the question. It doesn't ask why is it doing it, it's asking how to remove it.– roobyFeb 25, 2020 at 23:44
File -> Close folder doesn't work in my mac, but if I click on mac's close ( the red circle) then from the dock click on the application again, the folder is removed from the explorer.
Of course this question refers to an old vscode version and vscode now has both, "Add Folder to Workspace..." and "Remove Folder from Workspace".
But there is still at least one occasion where this question may still arise: You do not have this option on subdirectories of an added folder. So you have to do "Remove Folder from Workspace" on the right folder and add subdirectories you want to keep afterwards.
Try the same as File -> Close Folder
. This will close your folder and before that try File -> Open folder
to open the file location. Close your folder and go to the location where the file locate and delete it.