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
.foldercontentspitteroutterignore
file (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.gitignore
in addition to the.foldercontentspitteroutterignore
file, 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-tree
option, with or without.gitignore
filtering.
- .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
.gitignore
and.foldercontentspitteroutterignore
by 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-tree
option to print the directory tree at the top of the output file, with or without.gitignore
filtering. - Disable
.gitignore
: You can bypass.gitignore
by using the--no-gitignore
flag. By default, the tool respects.gitignore
and 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
fcso
from a folder to filter the current directory and respect both the.gitignore
and.foldercontentspitteroutterignore
files: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
.gitignore
and process all files:fcso --output output.md --no-gitignore
-
Create a
.foldercontentspitteroutterignore
file in your project folder. Example.foldercontentspitteroutterignore
:package-lock.json fonts/
-
This will exclude
package-lock.json
and any folder namedfonts
from processing. -
You can still dynamically specify additional filters via the command line:
fcso --output output.md src/ README.md
-
You can also disable
.gitignore
filtering 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.gitignore
filtering.[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.md
This 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