FileCon is a simple and efficient CLI tool that allows you to concatenate specific file types from a directory into a single output file. It provides both a wizard-style interface and command-line options for flexibility. You can also remove tabs and extra spaces from the content during concatenation.
- Wizard-style interface for ease of use
- Command-line options for advanced users
- Ability to concatenate files based on their extension
- Option to remove tabs and extra spaces from the concatenated files
- Ignore specific file extensions during concatenation
- Ignore specific folders during search
- Support for
.fileconignorefile to define patterns to ignore - Support for global environment variable
FILECON_EXTIGNORE - Detailed summary of concatenation results
- Automatic "filecon_" prefix for output files
filecon [flags]| Flag | Description | Default |
|---|---|---|
-d, --dir string |
Directory to search for files | Current directory |
-e, --ext string |
File extension to search for (with or without dot) | None |
-o, --out string |
Output file name | filecon_output_<timestamp>.txt |
-r, --remove-spaces |
Remove all tabs and extra spaces from the content | false |
-i, --ignore-ext |
File extensions to ignore (comma-separated) | None |
-f, --ignore-folders |
Folders to ignore during search (comma-separated) | None |
-h, --help |
Help for filecon |
-
Run the interactive wizard:
filecon
-
Concatenate all
.gofiles in the current directory:filecon --dir=. --ext=go --out=output.txt
-
Concatenate all
.jsfiles in/path/to/dir, removing extra spaces:filecon --dir=/path/to/dir --ext=.js --out=result.js --remove-spaces
-
Concatenate all
.pyfiles in the current directory, ignoring.pycfiles and thevenvfolder:filecon --dir=. --ext=py --ignore-ext=pyc --ignore-folders=venv,__pycache__
-
Using
.fileconignorefile: Create a file named.fileconignorein your target directory with patterns to ignore:# Comments are supported *.tmp *.bak node_modules/ .git/ -
Using environment variable:
export FILECON_EXTIGNORE=tmp,bak,test.js filecon --dir=. --ext=js
Note: If you don't provide all required flags (
dir,ext,out), the interactive wizard will start by default.
You can create a .fileconignore file in the target directory to specify files and folders to ignore. The syntax is similar to .gitignore:
- Use
*.extor.extto ignore file extensions - Use folder names with or without trailing slashes to ignore directories
- Use
#for comments
Set the FILECON_EXTIGNORE environment variable to specify file extensions to ignore globally:
export FILECON_EXTIGNORE=tmp,bak,logAll output files are automatically prefixed with "filecon_" if not already present. The output file will contain:
- A signature with the FileCon version and generation timestamp
- Information about any ignore patterns used
- Each file's content preceded by its path and a separator
# Note: Change the architecture to arm64 for Apple Silicon-based Macs. Check the 'build' folder for your architecture.
sudo rm -f /usr/local/bin/filecon
sudo curl -L -o /usr/local/bin/filecon https://github.com/monzim/filecon/raw/main/build/0.0.2/filecon-macos-arm64
sudo chmod +x /usr/local/bin/filecon# Note: Change the architecture to arm64 for ARM-based Linux systems. Check the 'build' folder for your architecture.
sudo rm -f /usr/local/bin/filecon
sudo curl -L -o /usr/local/bin/filecon https://github.com/monzim/filecon/raw/main/build/0.0.2/filecon-linux
sudo chmod +x /usr/local/bin/filecon- Download the
.exefile for your architecture from the latest releases. - Add the location of the downloaded
.exefile to your system's PATH, or run it directly from the command prompt.
If you prefer to build from source, you need Go installed on your system.
-
Clone the repository:
git clone https://github.com/monzim/filecon.git cd filecon -
Build the application:
go build -o filecon
-
Move the
fileconbinary to your PATH:sudo mv filecon /usr/local/bin/
Feel free to open issues and contribute to the project by creating pull requests.
This project is licensed under the MIT License.
Developed by Azraf Al Monzim