{"id":31904472,"url":"https://github.com/cwksc/destruct-folder","last_synced_at":"2025-10-13T13:50:12.870Z","repository":{"id":65168168,"uuid":"585236098","full_name":"CWKSC/destruct-folder","owner":"CWKSC","description":"A library for destructing folders content data like txt, image, npy https://pypi.org/project/destructfolder/","archived":false,"fork":false,"pushed_at":"2024-06-17T03:55:43.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T16:21:37.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/CWKSC.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":"2023-01-04T16:55:57.000Z","updated_at":"2024-08-14T07:19:21.000Z","dependencies_parsed_at":"2024-06-17T05:06:15.376Z","dependency_job_id":null,"html_url":"https://github.com/CWKSC/destruct-folder","commit_stats":null,"previous_names":["cwksc/destructfolder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CWKSC/destruct-folder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CWKSC%2Fdestruct-folder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CWKSC%2Fdestruct-folder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CWKSC%2Fdestruct-folder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CWKSC%2Fdestruct-folder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CWKSC","download_url":"https://codeload.github.com/CWKSC/destruct-folder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CWKSC%2Fdestruct-folder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015357,"owners_count":26085686,"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-13T02:00:06.723Z","response_time":61,"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":[],"created_at":"2025-10-13T13:49:20.386Z","updated_at":"2025-10-13T13:50:12.864Z","avatar_url":"https://github.com/CWKSC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# destructfolder\n\nDestruct folders and get data `txt`, `png`, `npy`\n\n\u003e [!NOTE]\n\u003e \n\u003e It is created when I am doing some data processing work\n\u003e\n\u003e I need to read some data from `.png`, `.txt`\n\u003e \n\u003e Reading data from different folder is trouble, repeated, and hard to maintain\n\u003e\n\u003e So I make a library for destruct folder, read data, and store into dict \n\n\u003e [!NOTE]\n\u003e\n\u003e This is also my first time learning how to publish a python library\n\u003e\n\u003e https://pypi.org/project/destructfolder/\n\u003e\n\u003e In 2020, nowaday should have better way to publish\n\u003e\n\u003e Not longer maintain, just for fun\n\u003e\n\u003e If I restart this project, I will created a DSL for it or just use json \n\n## Exmaple:\n\nFile structure:\n\n```\n- data\n    - txt_folder1\n        1.txt\n        2.txt\n    - txt_folder2\n        1.txt\n        2.txt\n    - txt_folder3\n        1.txt\n        2.txt\n- cache\n    - foreach_folder\n        - txt_folder_n1\n            1.txt\n            2.txt\n        - txt_folder_n1\n            1.txt\n            2.txt\n        - txt_folder_n1\n            1.txt\n            2.txt\n    - txt_folder4\n        1.txt\n        2.txt\n    - txt_folder6\n        1.txt\n        2.txt\n```\n\n```python\nfrom destructfolder import *\n\nfolderStructure =  [\n    Folder(\"data\",[\n        TxtFolder(\"txt_folder1\", key_for_contents=\"txt_folder1_key\"),\n        TxtFolder(\"txt_folder2\", key_for_contents=\"txt_folder2_key\"),\n        TxtFolder(\"txt_folder3\", key_for_contents=\"txt_folder3_key\"),\n    ]),\n    Folder(\"cache\", [\n        TxtFolder(\"txt_folder4\", key_for_contents=\"txt_folder4_key\"),\n        ForEachFolder(\"foreach_folder\", key_for_path=\"foreach_folder_key_for_path\", key_for_subfolder=\"foreach_folder_key\", subfolder=\n            TxtFolder(\"txt_folder5_inside_foreach_folder\", key_for_contents=\"txt_folder5_inside_foreach_folder_key\")\n        ),\n        TxtFolder(\"txt_folder6\", key_for_contents=\"txt_folder6_key\")\n    ])\n]\n\nrootPath = Path(__file__).parent\nbuildFramework(rootPath, folderStructure)\n\nfolderDict = destructFolder(rootPath, folderStructure)\n\nprint(folderDict)\nprint()\nprint(folderDict[\"txt_folder1_key\"])\nprint(folderDict[\"txt_folder2_key\"])\nprint(folderDict[\"txt_folder3_key\"])\nprint()\nprint(folderDict[\"txt_folder4_key\"])\nprint(folderDict[\"foreach_folder_key\"][\"txt_folder_n1\"])\nprint(folderDict[\"foreach_folder_key\"][\"txt_folder_n2\"])\nprint(folderDict[\"foreach_folder_key\"][\"txt_folder_n3\"])\nprint(folderDict[\"txt_folder6_key\"])\n```\n\nOutput:\n\n```\nLoading TxtFolder contents (txt_folder1) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder2) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder3) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder4) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder_n1) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder_n2) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder_n3) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\nLoading TxtFolder contents (txt_folder6) ...\n100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00\u003c?, ?it/s] \n\n{'txt_folder1_key': {'1': 'this is txt file in txt_folder1', '2': 'this is another txt file in txt_folder1'}, 'txt_folder2_key': {'1': 'txt file in txt_folder2', '2': 'another txt file in txt_folder2'}, 'txt_folder3_key': {'1': 'txt in txt_folder3', '2': 'another txt in txt_folder3'}, 'txt_folder4_key': {'1': 'this is txt file in txt_folder4', '2': 'this is another txt file in txt_folder4'}, 'foreach_folder_key_for_path': WindowsPath('D:/Develop/Python/DestructFolder/example/cache/foreach_folder'), 'foreach_folder_key': {'txt_folder_n1': {'txt_folder5_inside_foreach_folder_key': {'1': 'this is txt file in txt_folder_n1', '2': 'this is another txt file in txt_folder_n1'}}, 'txt_folder_n2': {'txt_folder5_inside_foreach_folder_key': {'1': 'this is txt file in txt_folder_n2', '2': 'this is another txt file in txt_folder_n2'}}, 'txt_folder_n3': {'txt_folder5_inside_foreach_folder_key': {'1': 'this is txt file in txt_folder_n3', '2': 'this is another txt file in txt_folder_n3'}}}, 'txt_folder6_key': {'1': 'this is txt file in txt_folder6', '2': 'this is another txt file in txt_folder6'}}\n\n{'1': 'this is txt file in txt_folder1', '2': 'this is another txt file in txt_folder1'}\n{'1': 'txt file in txt_folder2', '2': 'another txt file in txt_folder2'}\n{'1': 'txt in txt_folder3', '2': 'another txt in txt_folder3'}\n\n{'1': 'this is txt file in txt_folder4', '2': 'this is another txt file in txt_folder4'}\n{'txt_folder5_inside_foreach_folder_key': {'1': 'this is txt file in txt_folder_n1', '2': 'this is another txt file in txt_folder_n1'}}\n{'txt_folder5_inside_foreach_folder_key': {'1': 'this is txt file in txt_folder_n2', '2': 'this is another txt file in txt_folder_n2'}}\n{'txt_folder5_inside_foreach_folder_key': {'1': 'this is txt file in txt_folder_n3', '2': 'this is another txt file in txt_folder_n3'}}\n{'1': 'this is txt file in txt_folder6', '2': 'this is another txt file in txt_folder6'}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwksc%2Fdestruct-folder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcwksc%2Fdestruct-folder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwksc%2Fdestruct-folder/lists"}