The Folder Content Spitter-Outer (FCSO) is a powerful shell-based tool for filtering files and folders in a directory tree. It allows you to:
- Automatically exclude files and folders using a
.foldercontentspitteroutterignorefile (similar to.gitignore). - Filter files/folders dynamically by specifying them as command-line arguments.
- Output contents of filtered files into a single file with markdown code block formatting.
- Highlight syntax based on file extensions (e.g.,
.js,.py,.ts). - Exclude large or unnecessary files from being processed.
- Optionally disable
.gitignore: By default, the tool respects.gitignorein addition to the.foldercontentspitteroutterignorefile, but you can disable this with--no-gitignore. - Print the directory tree: You can print the full directory tree at the top of the output file with the
--print-treeoption, with or without.gitignorefiltering.
- .foldercontentspitteroutterignore: Like
.gitignore, this file allows you to specify files and folders that should always be excluded from processing. - Command-line filtering: You can pass specific files or folders to include dynamically, after respecting both
.gitignoreand.foldercontentspitteroutterignoreby default. - Automatic markdown formatting: Outputs the contents of filtered files into a single file formatted in markdown with code blocks.
- Dynamic syntax highlighting: Detects and highlights code based on file extensions (e.g., JavaScript, Python, CSS).
- Print the directory tree: Use the
--print-treeoption to print the directory tree at the top of the output file, with or without.gitignorefiltering. - Disable
.gitignore: You can bypass.gitignoreby using the--no-gitignoreflag. By default, the tool respects.gitignoreand excludes files listed there, along with any specified in.foldercontentspitteroutterignore.
-
Add the custom tap:
brew tap tannerabread/folder-content-spitter-outter
-
Install the tool:
brew install fcso
-
The tool will automatically be aliased to
fcso, so you can run it from any directory.
-
Run
fcsofrom a folder to filter the current directory and respect both the.gitignoreand.foldercontentspitteroutterignorefiles:fcso --output output.md
-
Use specific files or folders to filter:
fcso --output output.md src/ README.md
-
Print the full directory tree at the top of the output file:
fcso --output output.md --print-tree
-
Use filter-only mode to include only specific files/folders:
fcso --output output.md --filter-only src/ README.md
-
Ignore
.gitignoreand process all files:fcso --output output.md --no-gitignore
-
Create a
.foldercontentspitteroutterignorefile in your project folder. Example.foldercontentspitteroutterignore:package-lock.json fonts/ -
This will exclude
package-lock.jsonand any folder namedfontsfrom processing. -
You can still dynamically specify additional filters via the command line:
fcso --output output.md src/ README.md
-
You can also disable
.gitignorefiltering while still respecting.foldercontentspitteroutterignore:fcso --output output.md --no-gitignore
-
Print the full directory tree:
fcso --output output.md --print-tree
-o|--output <output_file>: Specify the output file where the filtered content will be written.-t|--print-tree: Print the directory tree at the top of the output file.-f|--filter-only: Include only the specified files/folders for filtering.--no-gitignore: Disable.gitignorefiltering.[files/folders]: Additional arguments that specify which files or folders to include.
# Add .foldercontentspitteroutterignore to your project
echo "package-lock.json" > .foldercontentspitteroutterignore
echo "node_modules/" >> .foldercontentspitteroutterignore
# Run fcso to output filtered content
fcso --output combined_output.md src/ README.mdThis will exclude package-lock.json and node_modules/ from the output and include only the contents from the src folder and README.md.
MIT License