{"id":15547654,"url":"https://github.com/lucaangioloni/get_files_list","last_synced_at":"2025-04-15T21:24:37.174Z","repository":{"id":57714615,"uuid":"517272957","full_name":"LucaAngioloni/get_files_list","owner":"LucaAngioloni","description":"Python package that provides a utility function to recursively get files that match a pattern.","archived":false,"fork":false,"pushed_at":"2025-02-13T12:31:02.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T01:26:13.774Z","etag":null,"topics":["filelist","files","match","pattern","recursive"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/get-files-list/","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/LucaAngioloni.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}},"created_at":"2022-07-24T08:54:47.000Z","updated_at":"2025-02-13T12:31:05.000Z","dependencies_parsed_at":"2022-09-02T22:00:54.879Z","dependency_job_id":null,"html_url":"https://github.com/LucaAngioloni/get_files_list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaAngioloni%2Fget_files_list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaAngioloni%2Fget_files_list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaAngioloni%2Fget_files_list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaAngioloni%2Fget_files_list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucaAngioloni","download_url":"https://codeload.github.com/LucaAngioloni/get_files_list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249155491,"owners_count":21221612,"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":["filelist","files","match","pattern","recursive"],"created_at":"2024-10-02T13:09:56.379Z","updated_at":"2025-04-15T21:24:37.149Z","avatar_url":"https://github.com/LucaAngioloni.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Get Files List\n\nPython package that provides a utility function to recursively get files that match a pattern.\n\n## Installation\n\nInstall using pip:\n\n```bash\npip install get_files_list\n```\n\n## Usage\n\nExample of this package usage in a folder with the following structure:\n\n```txt\n ├──      LICENSE\n ├──      README.md\n ├──      deploy.sh\n └──      get_files_list/\n │  ├────      __init__.py\n │  └────      get_dir_content.py\n ├──      requirements.in\n ├──      requirements.txt\n └──      setup.py\n```\n\nThe following code:\n\n```python\nfrom get_files_list import get_dir_content\n\n# Print every file\nprint(\"Print every file\\n\")\nfor file in get_dir_content(\"./\"):\n    print(file)\n\n# Print everyPython file\nprint(\"\\n\\nPrint every Python file\\n\")\nfor file in get_dir_content(\"./\", pattern=\"*.py\"):\n    print(file)\n\n# Print every Python file without the prepended folder name\nprint(\"\\n\\nPrint every Python file without the prepended folder name\\n\")\nfor file in get_dir_content(\"./\", prepend_folder_name=False, pattern=\"*.py\"):\n    print(file)\n\n# Print every file without recursion\nprint(\"\\n\\nPrint every file without recursion\\n\")\nfor file in get_dir_content(\"./\", recursive=False):\n    print(file)\n\n# Print every file that is not a Python file\nprint(\"\\n\\nPrint every file that is not a Python file\\n\")\nfor file in get_dir_content(\"./\", exclude_pattern=\"*.py\"):\n    print(file)\n```\n\nWould output:\n\n```txt\nPrint every file\n\n./LICENSE\n./requirements.txt\n./get_files_list/get_dir_content.py\n./get_files_list/__init__.py\n./README.md\n./setup.py\n./deploy.sh\n./requirements.in\n\n\nPrint every python file\n\n./get_files_list/get_dir_content.py\n./get_files_list/__init__.py\n./setup.py\n\n\nPrint every python file without the prepended folder name\n\nget_files_list/get_dir_content.py\nget_files_list/__init__.py\nsetup.py\n\n\nPrint every file without recursion\n\n./LICENSE\n./requirements.txt\n./README.md\n./setup.py\n./deploy.sh\n./requirements.in\n\n\nPrint every file that is not a Python file\n\n./LICENSE\n./requirements.txt\n./README.md\n./deploy.sh\n./requirements.in\n```\n\n### Generator\n\n`get_dir_content` is a Python *generator* so the following code would not work:\n\n```python\nfrom get_files_list import get_dir_content\n\nnum_py_files = len(get_dir_content(\"./\", pattern=\"*.py\"))\n# TypeError: object of type 'generator' has no len()\n\n# You have to explicitely generate a list\nnum_py_files = len(list(get_dir_content(\"./\", pattern=\"*.py\")))\n# This works\n```\n\nThis is also valid if you want to order, shuffle or slice the list of files.\n\n## Inspiration\n\nThis code is inspired by this StackOverflow [Question/Answer](https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaangioloni%2Fget_files_list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucaangioloni%2Fget_files_list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucaangioloni%2Fget_files_list/lists"}