This script generates a visual representation of the directory structure of a specified root directory. It supports exporting the structure to a Markdown file and offers various options to customize the output.
├── .env
├── .gitignore
├── README.md
├── config/
│ ├── env.go
├── data/
│ ├── found-url.json
│ ├── url.txt
├── db/
│ ├── db.go
├── directory_structure.md
├── go.mod
├── go.sum
├── main.go
├── rss/
│ ├── fetch.go
├── telegram/
│ ├── telegram.go
├── utils/
├── http.go
├── utils.go
- Ensure you have Python installed (version 3.6 or later recommended).
- Install the required Python packages:
pip install colorama
Note
Just need in -c switch for colorful, you don't need install package for run the script
Switch/Option | Description | Example Usage |
---|---|---|
<directory-path> |
Path to the root directory whose structure you want to display. | python main.py /home/project |
-md , --export-md |
Export the directory structure to a Markdown file. | python main.py /home/project -md |
-d , --depth <number> |
Limit the depth of directory traversal. | python main.py /home/project -d 2 |
-c , --color |
Enable colorful output in the terminal. | python main.py /home/project -c |
-
Display the Directory Structure
python main.py /home/project
-
Export to Markdown
python main.py /home/project --export-md
-
Limit Depth to 2 Levels
python main.py /home/project --depth 2
-
Enable Colorful Output
python main.py /home/project -c
-
Combine Options
python main.py /home/project --export-md --depth 3 -c
Note
- Colorful Output: The
-c
or--color
switch enables colorful terminal output usingcolorama
. Without this switch, the output will be plain text. - Depth Limiting: Use the
--depth
option to control how many levels deep the directory tree should be displayed. - Markdown Export: The
--export-md
option saves the directory structure to a Markdown file for documentation purposes.
For any additional options or troubleshooting, please refer to the Troubleshooting section of this documentation.
- Permission Errors: If you encounter permission errors, make sure you have the necessary permissions to access the directories and files.
- Invalid Directory Path: Ensure the specified directory path is correct and exists.
Feel free to submit issues, suggestions, or pull requests. Contributions are welcome!