{"id":23576118,"url":"https://github.com/goggle/flatten","last_synced_at":"2025-10-03T14:53:34.499Z","repository":{"id":144201450,"uuid":"85398221","full_name":"goggle/flatten","owner":"goggle","description":"Command-line tool to flatten a directory structure.","archived":false,"fork":false,"pushed_at":"2017-10-07T20:43:24.000Z","size":32,"stargazers_count":8,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T19:47:43.231Z","etag":null,"topics":["cleaner","command-line-tool","golang"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/goggle.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,"zenodo":null}},"created_at":"2017-03-18T12:04:57.000Z","updated_at":"2023-12-15T06:03:06.000Z","dependencies_parsed_at":"2023-06-18T15:06:20.877Z","dependency_job_id":null,"html_url":"https://github.com/goggle/flatten","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/goggle/flatten","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goggle%2Fflatten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goggle%2Fflatten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goggle%2Fflatten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goggle%2Fflatten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goggle","download_url":"https://codeload.github.com/goggle/flatten/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goggle%2Fflatten/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269915168,"owners_count":24495647,"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-08-11T02:00:10.019Z","response_time":75,"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":["cleaner","command-line-tool","golang"],"created_at":"2024-12-26T21:12:46.415Z","updated_at":"2025-10-03T14:53:33.840Z","avatar_url":"https://github.com/goggle.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flatten\n\nFlatten is a command-line tool to flatten a directory structure.\n\n+ [Installation](#installation)\n+ [Usage](#usage)\n+ [Example](#example)\n\n## Installation\n\nMake sure that you have [Go installed](https://golang.org/dl/), and that you have set up your [Go environment](https://golang.org/doc/code.html#GOPATH).\n\n```\ngo get github.com/goggle/flatten\n```\n\n## Usage\n\n```\nUsage:\n  flatten [SOURCE] [DESTINATION] [-c | --copy-only] [-f | --force] [--include-source-files] [-s | --simulate-only] [--verbose]\n  flatten -h | --help\n  flatten -v\n\nRecursively flatten the directory structure from SOURCE to DESTINATION.\n\nArguments:\n  SOURCE                    Optional source directory (default is current directory).\n  DESTINATION               Optional destination directory (default is current directory).\n\nOptions:\n  -c --copy-only            Do not remove anything from the source directory.\n  -f --force                Do not propose a simulation first, immediately execute the command.\n  --include-source-files    Include the files which are directly located in the SOURCE directory.\n  -s --simulate-only        Do not move or copy any files on the system,\n                            just output the expected result.\n  --verbose                 Explain what is being done.\n  -v --version              Show version.\n  -h --help                 Show this screen.\n```\n\n## Example\n\nAssume we have the following directory strcuture in `/home/goggle/example/`:\n\n```\n/home/goggle/example\n├── c_progs\n│   └── prog01\n│       ├── hello\n│       └── hello.c\n├── data\n│   ├── dat001\n│   │   ├── data_apples.txt\n│   │   ├── data_monkeys.txt\n│   │   └── data_trees.txt\n│   ├── dat002\n│   │   ├── data_apples.txt\n│   │   ├── data_monkeys.txt\n│   │   └── data_trees.txt\n│   ├── dat003\n│   │   ├── data_apples.txt\n│   │   ├── data_monkeys.txt\n│   │   └── data_trees.txt\n│   └── dat004\n│       ├── data_apples.txt\n│       ├── data_monkeys.txt\n│       └── data_trees.txt\n├── hello\n└── hello_1\n```\n\nBy running `flatten` in `/home/goggle/example` we get the following result:\n\n```\n/home/goggle/example\n├── data_apples_1.txt\n├── data_apples_2.txt\n├── data_apples_3.txt\n├── data_apples_4.txt\n├── data_monkeys_1.txt\n├── data_monkeys_2.txt\n├── data_monkeys_3.txt\n├── data_monkeys_4.txt\n├── data_trees_1.txt\n├── data_trees_2.txt\n├── data_trees_3.txt\n├── data_trees_4.txt\n├── hello\n├── hello_01\n├── hello_1\n└── hello.c\n```\n\nAll the files in the subdirectories of `/home/goggle/example/` have been moved into `/home/goggle/example` and the empty directories have been removed. Note, that no regular file has been removed, even though we have file name collisions (e.g. the file `data_apples.txt` exists four times). Flatten does automatically take care of such filename collisions and adds a number to the filename if such a collision happens.\n\nIf we want to keep the original files in their subdirectories, we can use the `--copy-only` option. `flatten -c` or `flatten --copy-only` executed in `/home/goggle/example` will lead to the following result:\n\n```\n/home/goggle/example\n├── c_progs\n│   └── prog01\n│       ├── hello\n│       └── hello.c\n├── data\n│   ├── dat001\n│   │   ├── data_apples.txt\n│   │   ├── data_monkeys.txt\n│   │   └── data_trees.txt\n│   ├── dat002\n│   │   ├── data_apples.txt\n│   │   ├── data_monkeys.txt\n│   │   └── data_trees.txt\n│   ├── dat003\n│   │   ├── data_apples.txt\n│   │   ├── data_monkeys.txt\n│   │   └── data_trees.txt\n│   └── dat004\n│       ├── data_apples.txt\n│       ├── data_monkeys.txt\n│       └── data_trees.txt\n├── data_apples_1.txt\n├── data_apples_2.txt\n├── data_apples_3.txt\n├── data_apples_4.txt\n├── data_monkeys_1.txt\n├── data_monkeys_2.txt\n├── data_monkeys_3.txt\n├── data_monkeys_4.txt\n├── data_trees_1.txt\n├── data_trees_2.txt\n├── data_trees_3.txt\n├── data_trees_4.txt\n├── hello\n├── hello_01\n├── hello_1\n└── hello.c\n```\n\nBy default, flatten will perform a simulation of its actions first, and ask the user, if they want to continue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoggle%2Fflatten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoggle%2Fflatten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoggle%2Fflatten/lists"}