{"id":15652002,"url":"https://github.com/klieret/randomfiletree","last_synced_at":"2025-04-07T10:29:48.272Z","repository":{"id":34650952,"uuid":"182217162","full_name":"klieret/RandomFileTree","owner":"klieret","description":"Create random file structures in python for testing purposes.","archived":false,"fork":false,"pushed_at":"2025-03-03T21:40:29.000Z","size":109,"stargazers_count":33,"open_issues_count":7,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T09:08:17.176Z","etag":null,"topics":["hacktoberfest","python3","testing","unit-testing","unittest"],"latest_commit_sha":null,"homepage":"https://randomfiletree.rtfd.io/","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/klieret.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2019-04-19T06:54:23.000Z","updated_at":"2025-02-13T05:54:54.000Z","dependencies_parsed_at":"2023-11-10T11:27:34.440Z","dependency_job_id":"c1c7b690-5681-43c2-863a-bd687878ab42","html_url":"https://github.com/klieret/RandomFileTree","commit_stats":{"total_commits":107,"total_committers":9,"mean_commits":11.88888888888889,"dds":0.7009345794392523,"last_synced_commit":"99893b85745eeb908f55f699fdc78bc6a62c3e9c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2FRandomFileTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2FRandomFileTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2FRandomFileTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klieret%2FRandomFileTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klieret","download_url":"https://codeload.github.com/klieret/RandomFileTree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247635432,"owners_count":20970735,"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":["hacktoberfest","python3","testing","unit-testing","unittest"],"created_at":"2024-10-03T12:40:54.345Z","updated_at":"2025-04-07T10:29:48.248Z","avatar_url":"https://github.com/klieret.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003e\u003ca href=\"https://randomfiletree.rtfd.io/\"\u003eRandomFileTree\u003c/a\u003e\u003c/a\u003e\u003c/h1\u003e\n\u003cp\u003e\u003cem\u003eGenerate random files and folders for testing purposes\u003c/em\u003e\u003c/p\u003e\n\u003cp\u003e\n\u003ca href=\"https://github.com/klieret/RandomFileTree/actions\"\u003e\u003cimg src=\"https://github.com/klieret/RandomFileTree/actions/workflows/test.yml/badge.svg\" alt=\"gh actions\"\u003e\u003c/a\u003e\n\u003ca href=\"https://results.pre-commit.ci/latest/github/klieret/RandomFileTree/master\"\u003e\u003cimg src=\"https://results.pre-commit.ci/badge/github/klieret/RandomFileTree/master.svg\" alt=\"pre-commit.ci status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/klieret/RandomFileTree?branch=master\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/klieret/RandomFileTree/badge.svg?branch=master\" alt=\"Coveralls\"\u003e\u003c/a\u003e\n\u003ca href=\"https://randomfiletree.readthedocs.io/\"\u003e\u003cimg src=\"https://readthedocs.org/projects/randomfiletree/badge/?version=latest\" alt=\"Documentation Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://badge.fury.io/py/RandomFileTree\"\u003e\u003cimg src=\"https://badge.fury.io/py/RandomFileTree.svg\" alt=\"Pypi status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/python/black\"\u003e\u003cimg src=\"https://img.shields.io/badge/code%20style-black-000000.svg\" alt=\"Black\"\u003e\u003c/a\u003e\n\u003ca href=\"https://gitter.im/RandomFileTree/community\"\u003e\u003cimg src=\"https://img.shields.io/gitter/room/RandomFileTree/community.svg\" alt=\"Gitter\"\u003e\u003c/a\u003e\n\u003ca href=\"https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project\"\u003e\u003cimg src=\"https://img.shields.io/badge/PR-Welcome-%23FF8300.svg\" alt=\"PR welcome\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\n## Description\n\nCreate a random file and directory tree/structure for testing purposes.\n\nThis is done in an iterative fashion: For every iteration, files and folders\nare created based on set probabilities in all subfolders of the target folder.\n\n## Installation\n\n`randomfiletree` can be installed with the python package manager:\n\n```sh\npip3 install randomfiletree\n```\n\nFor a local installation, you might want to use the `--user` switch of\n`pip`. You can also update your current installation with\n`pip3 install --upgrade randomfiletree`.\n\nFor the latest development version you can also work from a cloned\nversion of this repository:\n\n```sh\ngit clone https://github.com/klieret/randomfiletree/\ncd randomfiletree\npip3 install --user .\n```\n\n## Usage\nTake a look at the\n[documentation](https://randomfiletree.readthedocs.io/) for the\ncomplete picture.\n\n### Command line interface\n\nSimple command line interface:\n\n```sh\nrandomfiletree \u003coutput folder\u003e \\\n    -f \u003caverage number of files\u003e \\\n    -d \u003caverage number of folders\u003e \\\n    -r \u003crepeat\u003e\n```\n\nFor example, using the options `-f 3 -d 2 -r 2`, on average 2 folders and 3\nfiles are created in the first iteration, and another 2 folders and 3 files are\nadded to the output directory and each of its subdirectories in the second\niteration.\n\nType `randomfiletree -h` to see all supported arguments.\n\n## Python API\n\n```python\nimport randomfiletree\n\nrandomfiletree.iterative_gaussian_tree(\n    \"/path/to/basedir\",\n    nfiles=2.0,\n    nfolders=0.5,\n    maxdepth=5,\n    repeat=4\n)\n```\n\nRandomfiletree will now crawl through all directories in\n`/path/to/basedir` and create new files with the probabilities given in\nthe arguments.\n\n### Advanced examples\n\nIt is possible to pass an optional function to generate the random\nfilenames oneself:\n\n```python\nimport random\nimport string\n\ndef fname():\n    length = random.randint(5, 10)\n    return \"\".join(\n        random.choice(string.ascii_uppercase + string.digits)\n        for _ in range(length)\n    ) + '.docx'\n\nrandomfiletree.core.iterative_gaussian_tree(\n    \"/path/to/basedir\",\n    nfiles=100,\n    nfolders=10,\n    maxdepth=2,\n    filename=fname\n)\n```\n\nThe `payload` optional argument can be used to generate file contents\ntogether with their names. For example, it can be used to replicate some\ntemplate files with randomized names:\n\n```python\nimport itertools\nimport pathlib\nimport randomfiletree\n\ndef callback(target_dir: pathlib.Path) -\u003e pathlib.Path:\n    sourcedir = pathlib.Path(\"/path/to/templates/\")\n    sources = []\n    for srcfile in sourcedir.iterdir():\n        with open(srcfile, 'rb') as f:\n            content = f.read()\n        sources.append((srcfile.suffix, content))\n    for srcfile in itertools.cycle(sources):\n        path = target_dir / (randomfiletree.core.random_string() + srcfile[0])\n        with path.open('wb') as f:\n            f.write(srcfile[1])\n        yield path\n\nrandomfiletree.core.iterative_gaussian_tree(\n    \"/path/to/basedir\",\n    nfiles=10,\n    nfolders=10,\n    maxdepth=5,\n    repeat=4,\n    payload=callback\n)\n```\n\nif both `filename` and `payload` passed, the first option is ignored.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/donheshanthaka\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/61963664?v=4?s=100\" width=\"100px;\" alt=\"Heshanthaka\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eHeshanthaka\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/klieret/RandomFileTree/commits?author=donheshanthaka\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/bollwyvl\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/45380?v=4?s=100\" width=\"100px;\" alt=\"Nicholas Bollweg\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNicholas Bollweg\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/klieret/RandomFileTree/commits?author=bollwyvl\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/BubaVV\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/2842580?v=4?s=100\" width=\"100px;\" alt=\"Vadym Markov\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eVadym Markov\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/klieret/RandomFileTree/commits?author=BubaVV\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n  \u003ctfoot\u003e\n\n  \u003c/tfoot\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklieret%2Frandomfiletree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklieret%2Frandomfiletree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklieret%2Frandomfiletree/lists"}