{"id":20573549,"url":"https://github.com/timf34/printdirtree","last_synced_at":"2025-04-14T17:23:58.751Z","repository":{"id":221259917,"uuid":"753879460","full_name":"timf34/PrintDirTree","owner":"timf34","description":"Print directory tree structure and file contents with customizable exclusions via a Python CLI. ","archived":false,"fork":false,"pushed_at":"2025-04-01T17:39:42.000Z","size":59,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T18:47:02.427Z","etag":null,"topics":["os","package","pip","pypi-package","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/printdirtree/","language":"Python","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/timf34.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-02-07T00:38:25.000Z","updated_at":"2025-04-01T17:39:45.000Z","dependencies_parsed_at":"2024-06-15T02:35:48.515Z","dependency_job_id":"c3f4a5cd-ff73-4413-9811-7a246935f1d7","html_url":"https://github.com/timf34/PrintDirTree","commit_stats":null,"previous_names":["timf34/printdirectory","timf34/dirtree"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FPrintDirTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FPrintDirTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FPrintDirTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FPrintDirTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timf34","download_url":"https://codeload.github.com/timf34/PrintDirTree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248924514,"owners_count":21184096,"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","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":["os","package","pip","pypi-package","python"],"created_at":"2024-11-16T05:28:04.649Z","updated_at":"2025-04-14T17:23:58.746Z","avatar_url":"https://github.com/timf34.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PrintDirTree\n\n`printdirtree` is a command-line utility that prints the structure of a directory tree, \nallowing you to easily specify files and directories to exclude. \n\nYou can now also print the contents of all files, which is very useful for prompting LLMs. \n\n**Example:**\n\n```bash\n$ printdirtree\nPrintDirTree\n├── MANIFEST.in\n├── README.md\n├── printdirtree\n│   ├── __init__.py\n│   └── __main__.py\n└── setup.py\n```\n\nThis tool is very useful to aid with prompting ChatGPT. \n\n## Installation\n\nInstall `printdirtree` easily with pip:\n\n```sh\npip install printdirtree\n```\n\n## Usage\n\nTo use `printdirtree`, simply run the command followed by optional arguments to tailor the output to your needs. \nThe basic usage prints the current directory structure:\n\n```sh\nprintdirtree\n```\n\n### Specifying a Directory\n\nTo print the structure of a specific directory:\n\n```sh\nprintdirtree --dir /path/to/directory\n```\n\n### Excluding Directories and Files\n\nExclude specific directories and/or file patterns:\n\n```sh\nprintdirtree --exclude-dir node_modules --exclude-dir .git --exclude-file \"*.log\"\n```\n\n### Saving Preferences\n\nTo save your exclusions for future runs:\n\n```sh\nprintdirtree --exclude-dir temp --exclude-file \"*.tmp\" --save\n```\n\n### Viewing Current Exclusions\n\nSee what exclusions are currently saved:\n\n```sh\nprintdirtree --view-exclusions\n```\n\n### Including Directories and Files Back\n\nTo remove exclusions and include directories or files back into the printout:\n\n```sh\nprintdirtree --include-dir temp --include-file \"*.tmp\" --save\n```\n\n### Showing File Contents\n\nTo display both the directory structure and the contents of all files:\n\n```sh\nprintdirtree --show-contents\n```\nor just `-p`:\n```sh\nprintdirtree -p\n```\n\nThis will output the directory tree followed by each file's contents with its relative path as a comment. For example:\n\n```\ntemp\n├── a.py\n└── b.py\n\n# temp/a.py\nprint(\"a.py\")\n\n# temp/b.py\nprint(\"b.py\")\n```\n\nThis is particularly useful when sharing code with LLMs, as it provides both structure and content in a clear, readable format.\n\n\n### Copy output to clipboard \n\nJust use the `-c` flag!\n\n\n### Print file outputs too!\n\nJust use the `-p` flag!\n\n\n## Example Usage\n\nAfter installing `printdirtree`, you can run it to visualize the structure of your project directory. Here's an example command that excludes `.git` files:\n\n```sh\nprintdirtree --exclude-file \".git\"\n```\n\nOutput for the `PrintDirTree` project might look like this:\n\n```\nPrintDirTree\n├── MANIFEST.in\n├── README.md\n├── printdirtree\n│   ├── __init__.py\n│   └── __main__.py\n└── setup.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimf34%2Fprintdirtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimf34%2Fprintdirtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimf34%2Fprintdirtree/lists"}