cpdirmk is a powerful command-line tool that generates a Markdown representation of directory structures, including the content of text files. It's perfect for documentation, project overviews, and sharing folder structures in a readable format.
- 📁 Generates a Markdown representation of directory structures
- 📄 Includes content of text files in the output
- 🌳 Supports customizable depth limitation for directory traversal
- 🚫 Allows ignoring specific files or directories
- 🔍 Intelligently identifies and handles various file types
- 🔄 Supports .gitignore files to automatically exclude ignored files
- 💻 Compatible with Linux, macOS, and Windows (via MSYS/Cygwin)
- 🎨 Produces clean and formatted Markdown output
-
Clone this repository:
git clone https://github.com/ericbercol/cpdirmk.git -
Navigate to the project directory:
cd cpdirmk -
Run the installation script with root privileges:
sudo ./install.shThe script will install
cpdirmkand its man page, making it available system-wide.
-
Install MSYS2 or Cygwin on your Windows system.
-
Clone this repository:
git clone https://github.com/ericbercol/cpdirmk.git -
Navigate to the project directory:
cd cpdirmk -
Run the installation script:
./install.shThe script will install
cpdirmkin the user's bin directory.
Basic syntax:
cpdirmk [OPTIONS] DIRECTORY
--help: Display the help message and exit--version: Show the program version and exit--output=FILE: Specify the output file (default: output to terminal)--depth=NUMBER: Set the maximum depth for directory traversal--ignore=PATTERN: Ignore files/directories matching the specified pattern--use-gitignore: Respect patterns in .gitignore files found in directories--max-file-size=SIZE: Set the maximum size (in bytes) to include file content
-
Generate a Markdown representation of the current directory:
cpdirmk . -
Create a structure of a specific directory with a custom output file:
cpdirmk --output project_structure.md /path/to/your/project -
Limit the depth and ignore certain files/directories:
cpdirmk --depth 3 --ignore '*.tmp' --ignore 'node_modules' --output limited_structure.md /path/to/project -
Use .gitignore patterns to exclude files ignored by git:
cpdirmk --use-gitignore --output project_structure.md /path/to/project
cpdirmk intelligently handles various file types:
- Text Files: Content is included in the Markdown output.
- Binary Files: Marked as binary without content display.
- Special Files: Identified and handled appropriately (e.g., executables, symlinks).
- Large Files: Size is displayed instead of content for files exceeding a certain threshold.
cpdirmk has been tested and works on the following platforms:
- Linux: All major distributions
- macOS: Versions 10.13 and higher
- Windows: Via MSYS2 or Cygwin
Contributions to cpdirmk are welcome! Here's how you can help:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with clear, descriptive messages.
- Push your changes to your fork.
- Submit a pull request with a clear description of your changes.
Please ensure your code adheres to the existing style and passes all tests.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Eric Coleta - ericbercol@gmail.com
- Thanks to all contributors who have helped shape
cpdirmk. - Inspired by the need for easy-to-share directory structures in Markdown format.
For more detailed information, please refer to the man page by running man cpdirmk after installation or cpdirmk --help.