Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>File AggregatorNew to Visual Studio Code? Get it now.
File Aggregator

File Aggregator

mghiani0042

|
13 installs
| (0) | Free
Aggregates selected files into a single file.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

VS Code File Aggregator Extension

Overview

The File Aggregator Extension is a powerful VS Code tool designed to combine multiple files of the same type into a single aggregated file. It's particularly useful for developers who need to merge multiple source files while maintaining proper import statements and file organization.

Features

  • 🔍 Recursively scans directories for files
  • 🗂 Supports multiple file types (.py, .js, .ts, .cs)
  • 🔄 Intelligent import handling and deduplication
  • ⚡ Smart sorting options (by name or modification date)
  • ⚙️ Configurable exclusion patterns
  • 🎯 Preserves file structure and comments

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Click on the Extensions icon in the Activity Bar
  3. Search for "File Aggregator"
  4. Click Install

Manual Installation

  1. Download the .vsix file from the releases page
  2. Open VS Code
  3. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)
  4. Type "Install from VSIX" and select it
  5. Choose the downloaded .vsix file

Usage

Basic Usage

  1. Right-click on a folder in the VS Code explorer
  2. Select "Aggregate Files" from the context menu
  3. Choose the file extension you want to aggregate
  4. Select your sorting preference
  5. The aggregated file will be created in the selected folder

Command Palette

You can also trigger the aggregation through the command palette:

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)
  2. Type "Aggregate Files"
  3. Select a folder when prompted

Configuration

The extension can be configured through VS Code settings. You can modify these settings in your settings.json file:

{
  "fileAggregator.excludedFolders": [
    "node_modules",
    ".git",
    "dist",
    "build",
    "__pycache__"
  ],
  "fileAggregator.excludedFiles": [],
  "fileAggregator.omitUnderscoreFiles": false
}

Available Settings

Setting Description Default
fileAggregator.excludedFolders Folders to exclude from aggregation ["node_modules", ".git", "dist", "build", "__pycache__"]
fileAggregator.excludedFiles Specific files to exclude []
fileAggregator.omitUnderscoreFiles Whether to exclude files starting with underscore false

Features in Detail

Import Handling

The extension intelligently handles imports across different file types:

  • Python:

    • Handles import and from ... import statements
    • Deduplicates imports
    • Preserves relative imports
  • JavaScript/TypeScript:

    • Supports ES6 imports and CommonJS requires
    • Handles dynamic imports
    • Maintains import order
  • C#:

    • Manages using statements
    • Consolidates namespace imports
    • Preserves using static directives

Sorting Options

  • By Name: Alphabetically sorts files
  • By Date Modified: Sorts files by last modification time (newest first)

File Organization

The aggregated file will be structured as follows:

  1. Import statements (deduplicated)
  2. Empty line separator
  3. File content sections, each preceded by a comment indicating the source file
  4. Empty lines between different file contents

Error Handling

The extension includes robust error handling for common scenarios:

  • Invalid folder selection
  • Unsupported file types
  • File access permissions
  • Duplicate file names
  • Import conflicts

Best Practices

For optimal results:

  1. Organize your files in a clean directory structure
  2. Keep import statements at the top of your files
  3. Use consistent import styles within your project
  4. Review the aggregated file before using in production

Known Limitations

  • Maximum file size limit: 50MB per file
  • Does not handle circular dependencies
  • Some language-specific imports might need manual adjustment
  • Binary files are not supported

Troubleshooting

Common Issues and Solutions

  1. Files Not Found

    • Check excluded folders settings
    • Verify file permissions
    • Ensure correct folder selection
  2. Import Errors

    • Review import statement formatting
    • Check for circular dependencies
    • Verify file path references
  3. Performance Issues

    • Reduce the number of files being processed
    • Exclude unnecessary folders
    • Check file sizes

Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions:

  1. Check the FAQ
  2. Search existing issues
  3. Create a new issue if needed

Changelog

See CHANGELOG.md for all notable changes.

Contributors

Thanks to all our contributors who help make this extension better!


📝 For more information and updates, visit our GitHub repository.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft