{"id":22922414,"url":"https://github.com/macsteini/directory-structure-generator","last_synced_at":"2026-05-04T00:33:10.164Z","repository":{"id":267661241,"uuid":"901969814","full_name":"MacSteini/Directory-Structure-Generator","owner":"MacSteini","description":"A script compatible with both, zsh and bash, to generate a Markdown file outlining the folder and file structure of the directory where the script is executed. The generated structure is presented in a readable Markdown format for easy documentation and sharing.","archived":false,"fork":false,"pushed_at":"2024-12-11T16:49:30.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T14:41:59.097Z","etag":null,"topics":["automation","bash","bash-script","directory-listing","generator","markdown","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MacSteini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-11T16:49:20.000Z","updated_at":"2024-12-11T16:51:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7041726-96d9-4586-9225-da5da3590e96","html_url":"https://github.com/MacSteini/Directory-Structure-Generator","commit_stats":null,"previous_names":["macsteini/directory-structure-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MacSteini/Directory-Structure-Generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FDirectory-Structure-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FDirectory-Structure-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FDirectory-Structure-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FDirectory-Structure-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MacSteini","download_url":"https://codeload.github.com/MacSteini/Directory-Structure-Generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FDirectory-Structure-Generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281386589,"owners_count":26492014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","bash","bash-script","directory-listing","generator","markdown","zsh"],"created_at":"2024-12-14T08:10:07.063Z","updated_at":"2025-10-28T05:06:44.125Z","avatar_url":"https://github.com/MacSteini.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Directory Structure Generator\n\nA script compatible with both `zsh` and `bash` to generate a Markdown file outlining the folder and file structure of the directory where the script is executed. The generated structure is presented in a readable Markdown format for easy documentation and sharing.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Usage Instructions](#usage-instructions)\n- [How It Works](#how-it-works)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [Licence](#licence)\n\n## Overview\n\nThis script generates a Markdown file, `structure.md`, detailing the folder and file hierarchy of the directory in which it is executed. The script excludes itself and its output file from the generated structure, making it ideal for documenting repositories, projects, or file collections.\n\n## Features\n\n- Compatible with **bash** and **zsh**\n- Recursively scans folders and files starting from the script’s directory\n- Outputs a well-structured Markdown file with:\n  - **📂 Folder icons**\n  - **📄 File icons**\n- Dynamically adjusts indentation for nested structures\n- Automatically excludes the script file and the generated Markdown file\n\n## Requirements\n\n- **Operating System:** macOS or Linux\n- **Shell:** _bash_ or _zsh_\n- **Tools Required:**\n  - `printf`\n  - `cd`\n  - `basename`\n\nThese utilities are included in most Unix-based operating systems.\n\n## Usage Instructions\n1. Save and execute the scripts in the chosen directory:\n   1. Save the zsh or bash script in the folder with the files to process\n   1. Make it executable: `chmod +x ./directory-structure-generator.zsh` resp. `chmod +x directory-structure-generator.sh`\n   1. Run the script: `./directory-structure-generator.zsh` resp. `./directory-structure-generator.sh`\n1. View the output:\n   - The script generates a `structure.md` file in the same directory. Open it with a text or Markdown viewer\n\n## How It Works\n\n1. **Script Execution Detection:**\n   - Identifies whether the script is run as a shell command or a script file\n1. **Target Folder and Output File Setup:**\n   - Automatically sets the target folder to the script’s directory\n   - Defines the output Markdown file as `structure.md`\n1. **Recursive Directory Traversal:**\n   - Iterates over all items in the folder recursively\n   - Adds folder and file names to the Markdown file with appropriate indentation and icons\n1. **Exclusion Rules:**\n   - Excludes the script itself and the output file from the generated structure\n\n## Troubleshooting\n\n- **Permission Denied:** Ensure the script has executable permissions: `chmod +x ./directory-structure-generator.zsh` resp. `chmod +x ./directory-structure-generator.sh`\n- **Empty Output File:** Verify that the directory contains files and is not empty\n- **File Not Found Errors:** Confirm that required commands (`basename`, `printf`, etc.) are installed and available\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork this repository\n1. Create a feature branch: `git checkout -b feature-branch`\n1. Commit your changes: `git commit -m \"Add feature\"`\n1. Push the branch: `git push origin feature-branch`\n1. Submit a pull request\n\nPlease ensure all changes are well-documented and tested.\n\n**Suggestions for improvements are highly encouraged!** Please ensure that your contributions adhere to the project’s coding standards and include appropriate documentation.\n\n## Licence\n\nThis project is licenced under the [MIT Licence](https://opensource.org/license/mit \"MIT Licence\"). You are free to use, modify, and distribute this project in compliance with the licence terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacsteini%2Fdirectory-structure-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacsteini%2Fdirectory-structure-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacsteini%2Fdirectory-structure-generator/lists"}