Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Create Files BatchNew to Visual Studio Code? Get it now.
Create Files Batch

Create Files Batch

Igor Lau

|
168 installs
| (0) | Free
Create multiple files at once with customizable templates.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Create Files Batch

Create Files Batch is a VSCode extension designed to streamline file creation by enabling the batch creation of files with a common name but varying suffixes or extensions. This extension is ideal for repetitive setups, such as creating multiple related files in the same folder or setting up new modules with similar structures (e.g., for a new use case in a backend).

Key Features

  • Batch file creation with customizable file suffixes.
  • Templates in settings.json allow pre-defining common file structures.
  • On-the-fly configuration for custom file setups.

Installation

Simply install the extension from the Visual Studio Code Marketplace and start using it!

Getting Started

This guide shows how to set up and use Create Files Batch with both predefined templates and custom options.

Example: NestJS Use Case

Suppose you frequently add new "use case" files in a NestJS backend. Here’s how to automate this structure with a template:

  1. Add a Template to settings.json file in .vscode folder

    Open your settings.json and define a template with a label, description, and file configurations:

    {
      "create-files-batch.templates": [
        {
          "label": "NestJS use case",
          "description": "Creates all the needed files for a new use case in the application.",
          "files": [
            { "suffix": ".controller.ts" },
            { "suffix": ".service.ts" },
            { "suffix": ".repository.ts" },
            {
              "suffix": ".module.ts",
              "content": [
                "import { Module } from '@nestjs/common';",
                "",
                "@Module({",
                "  controllers: [],",
                "  providers: [],",
                "})",
                "export class Module {}"
              ]
            }
          ]
        }
      ]
    }
    
  2. Create Files Using the Template

    1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and search for Create: Multiple Files....
    2. If more than one workspace is open, select the workspace to create files in.
    3. Select the "NestJS use case" template from the list.
    4. Specify the destination path.
    5. Enter a common file name prefix. For example, entering "auth" will create:
      • auth.controller.ts
      • auth.service.ts
      • auth.repository.ts
      • auth.module.ts

Creating Files Without a Predefined Template

  1. Open the Command Palette and select Create: Multiple Files....
  2. If prompted, choose the workspace.
  3. Select the built-in "Custom" option.
  4. Manually specify the suffixes you’d like to use.
  5. Follow the remaining prompts to choose a destination and enter the prefix.

Creating Files Through Context Menu

  1. Right click at the destination folder to open context menu.
  2. Select the Create: Multiple Files... option.
  3. Follow the prompts and steps and fill in the as desired.

Screenshots

Command Palette

  1. Create: Multiple Files... command:

Create Files Batch command

  1. Workspace selection:

Worspace selection

  1. Template selection:

Template selection

  1. Destination folder specification:

Destination folder specification

  1. File name specification:

File name specification

Context Menu

  1. Open Context Menu:

Open Context Menu

  1. Template selection:

Template Selection

  1. File name specification:

Template Selection

  1. Created files:

Created Files

Additional Configuration Options

You can define multiple templates in your settings.json for different use cases, each with a unique label, description, and file structure.

{
  "create-files-batch.templates": [
    {
      "label": "NestJS use case",
      "description": "Creates all the needed files for a new use case in the application.",
      "files": [
        {
          "suffix": ".controller.ts",
          "additional-path": "./controllers",
          "content": [
            "import { Controller } from '@nestjs/common';",
            "",
            "@Controller('foo')",
            "export class FooController {",
            " constructor() {",
            " }",
            "}"
          ]
        },
        {
          "suffix": ".service.ts",
          "additional-path": "./services",
          "content": [
            "import { Injectable, Logger } from '@nestjs/common';",
            "import { FooRepository } from './foo.repository';",
            "",
            "@Injectable()",
            "export class FooService {",
            "  private logger = new Logger(FooService.name);",
            "  constructor(private readonly fooRepository: FooRepository) {}",
            "}"
          ]
        },
        {
          "suffix": ".repository.ts",
          "additional-path": "./repositories",
          "content": [
            "import { Repository } from 'typeorm';",
            "import { InjectRepository } from '@nestjs/typeorm';",
            "",
            "export class FooRepository extends Repository<Entity> {",
            "  constructor(",
            "    @InjectRepository(User)",
            "    private repository: Repository<Entity>,",
            "  ) {",
            "    super(",
            "      repository.target,",
            "      repository.manager,",
            "      repository.queryRunner,",
            "    );",
            "  }",
            "}"
          ]
        },
        {
          "suffix": ".module.ts",
          "content": [
            "import { Module } from '@nestjs/common';",
            "import { FooController } from './foo.controller';",
            "import { FooRepository } from './foo.repository';",
            "import { FooService } from './foo.service';",
            "",
            "@Module({",
            "  controllers: [FooController],",
            "  providers: [FooRepository, FooService],",
            "})",
            "export class FooModule {}"
          ]
        }
      ]
    },
    {
      "label": "New NestJS use case with test files",
      "description": "Creates all the needed files for a new use case in the application including test files.",
      "files": [
        { "suffix": ".controller.ts" },
        { "suffix": ".controller.spec.ts" },
        { "suffix": ".service.ts" },
        { "suffix": ".service.spec.ts" },
        { "suffix": ".repository.ts" },
        { "suffix": ".repository.spec.ts" },
        { "suffix": ".module.ts" }
      ]
    }
  ]
}

Attributions

  • Multiple layer icons created by pancaza - Flaticon
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft