Skip to content
the poor coder

vscode multi level folder file creation

Poor Man
Published
Reading time
2 min read
On this page

VS Code Multi-Level Folder File Creation#

As a web developer, I have found myself in situations where I need to create multiple files and folders within a project. In such cases, manually creating files and folders can be tedious and error-prone. Fortunately, Visual Studio Code (VS Code) offers several ways to create multi-level folders and files that save time and minimize human error.

Using the Terminal#

The first and most common way to create multi-level folders and files is by using the integrated terminal in VS Code. To access the terminal, press Ctrl + ` (backtick) or select View > Terminal from the menu. Once the terminal is open, you can use standard Unix commands to create directories and files.

Bash
$ mkdir -p myproject/src/components
$ touch myproject/src/components/app.js

The above commands create a new directory named myproject in the current working directory. Then, it creates two subdirectories named src and components within myproject. Finally, it creates a new file named app.js inside the components directory.

Using the File Explorer#

The second way to create multi-level folders and files is by using the file explorer in VS Code. To access the file explorer, select View > Explorer from the menu. Once the file explorer is open, you can navigate to the directory where you want to create a new folder or file. Then, right-click on the parent directory and select New Folder or New File.

HTML
<div class="file-explorer">
  <ul>
    <li>myproject
      <ul>
        <li>src
          <ul>
            <li>components
              <ul>
                <li>app.js</li>
              </ul>
            </li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</div>

The above code shows a file explorer that represents the same directory structure as the previous example. You can see that the app.js file is nested under the components directory.

Using VS Code Extensions#

The third way to create multi-level folders and files is by using extensions in VS Code. There are many extensions available that provide shortcuts and improved functionality for file and folder creation. One popular extension is Todo Tree, which allows you to create files and folders by typing their paths directly into the editor.

JavaScript
// Type the following text in the editor:
// myproject/src/components/app.js

// Then, press Ctrl+Shift+Enter to create the file.

The above code shows how to create a new file named app.js inside the components directory of myproject using Todo Tree.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC