{"id":21747580,"url":"https://github.com/olivegamestudio/copyflatten","last_synced_at":"2025-10-04T14:37:03.368Z","repository":{"id":44379933,"uuid":"331060226","full_name":"olivegamestudio/CopyFlatten","owner":"olivegamestudio","description":"Copy source files recursively but place in a single destination folder.","archived":false,"fork":false,"pushed_at":"2023-05-30T15:57:32.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T22:54:52.146Z","etag":null,"topics":["copy","files","flatten","recursively"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olivegamestudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-01-19T17:39:31.000Z","updated_at":"2023-02-17T10:56:04.000Z","dependencies_parsed_at":"2025-01-25T22:48:38.238Z","dependency_job_id":"e11ebca9-1a31-481b-9a39-23a8c587239b","html_url":"https://github.com/olivegamestudio/CopyFlatten","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivegamestudio%2FCopyFlatten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivegamestudio%2FCopyFlatten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivegamestudio%2FCopyFlatten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olivegamestudio%2FCopyFlatten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olivegamestudio","download_url":"https://codeload.github.com/olivegamestudio/CopyFlatten/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244722736,"owners_count":20499154,"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":["copy","files","flatten","recursively"],"created_at":"2024-11-26T08:09:38.692Z","updated_at":"2025-10-04T14:37:03.362Z","avatar_url":"https://github.com/olivegamestudio.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CopyFlatten\n\nA simple command-line utility that recursively searches a directory tree and copies all matching files to a single flat destination directory.\n\n## Usage\n\n```bash\nCopyFlatten.exe \u003csource-directory\u003e \u003cdestination-directory\u003e \u003cfile-pattern\u003e\n```\n\n**Parameters:**\n- `source-directory` - The root directory to search recursively\n- `destination-directory` - The target directory where all files will be copied (created if it doesn't exist)\n- `file-pattern` - The file pattern to match (supports wildcards like `*.dll`, `*.txt`, etc.)\n\n## What It Does\n\n1. **Recursively searches** the source directory for files matching the pattern\n2. **Creates the destination directory** if it doesn't exist\n3. **Copies all matching files** to the destination directory (flattened structure)\n4. **Overwrites existing files** in the destination if they have the same name\n\n## Examples\n\n### Copy All DLL Files\n```bash\nCopyFlatten.exe \"C:\\MyProject\\bin\" \"C:\\AllDlls\" \"*.dll\"\n```\nCopies all `.dll` files from any subdirectory of `C:\\MyProject\\bin` into `C:\\AllDlls`.\n\n### Copy All Images\n```bash\nCopyFlatten.exe \"C:\\Photos\" \"C:\\AllPhotos\" \"*.jpg\"\n```\nFlattens a photo directory structure, copying all JPG files to a single folder.\n\n### Copy Configuration Files\n```bash\nCopyFlatten.exe \"C:\\Application\" \"C:\\Configs\" \"*.config\"\n```\nExtracts all configuration files from an application directory tree.\n\n### Copy All Files\n```bash\nCopyFlatten.exe \"C:\\Source\" \"C:\\Destination\" \"*.*\"\n```\nCopies every file from the source directory tree into a flat structure.\n\n## Common Use Cases\n\n### 1. Library Collection\nGather all shared libraries from a complex project structure:\n```bash\nCopyFlatten.exe \"C:\\Solution\\Projects\" \"C:\\Deploy\\Libraries\" \"*.dll\"\n```\n\n### 2. Asset Extraction\nExtract all assets of a specific type from a game or application:\n```bash\nCopyFlatten.exe \"C:\\Game\\Assets\" \"C:\\ExtractedTextures\" \"*.png\"\n```\n\n### 3. Log File Aggregation\nCollect log files from multiple subdirectories:\n```bash\nCopyFlatten.exe \"C:\\Logs\\2023\" \"C:\\AllLogs\" \"*.log\"\n```\n\n### 4. Documentation Collection\nGather documentation files from various project folders:\n```bash\nCopyFlatten.exe \"C:\\Projects\" \"C:\\AllDocs\" \"*.md\"\n```\n\n### 5. Build Artifact Collection\nCollect build outputs from multiple projects:\n```bash\nCopyFlatten.exe \"C:\\Solution\" \"C:\\BuildOutputs\" \"*.exe\"\n```\n\n## Directory Structure Example\n\n**Before (Source Structure):**\n```\nC:\\MyProject\\\n├── Core\\\n│   ├── MyApp.Core.dll\n│   └── Utils\\\n│       └── MyApp.Utils.dll\n├── Data\\\n│   └── MyApp.Data.dll\n└── Web\\\n    ├── MyApp.Web.dll\n    └── Plugins\\\n        └── MyApp.Plugins.dll\n```\n\n**After Running:** `CopyFlatten.exe \"C:\\MyProject\" \"C:\\FlatOutput\" \"*.dll\"`\n```\nC:\\FlatOutput\\\n├── MyApp.Core.dll\n├── MyApp.Utils.dll\n├── MyApp.Data.dll\n├── MyApp.Web.dll\n└── MyApp.Plugins.dll\n```\n\n## Integration Examples\n\n### Batch Script\n```batch\n@echo off\necho Flattening DLL files...\nCopyFlatten.exe \"%SOURCE_DIR%\" \"%DEPLOY_DIR%\\libs\" \"*.dll\"\n\necho Flattening config files...\nCopyFlatten.exe \"%SOURCE_DIR%\" \"%DEPLOY_DIR%\\configs\" \"*.config\"\n\necho Done!\n```\n\n### PowerShell\n```powershell\n$sourceDir = \"C:\\Build\\Output\"\n$deployDir = \"C:\\Deploy\"\n\n# Flatten different file types to separate directories\n\u0026 \"CopyFlatten.exe\" $sourceDir \"$deployDir\\Libraries\" \"*.dll\"\n\u0026 \"CopyFlatten.exe\" $sourceDir \"$deployDir\\Executables\" \"*.exe\"\n\u0026 \"CopyFlatten.exe\" $sourceDir \"$deployDir\\Configs\" \"*.config\"\n\nWrite-Host \"Files flattened successfully!\"\n```\n\n### CI/CD Pipeline\n```bash\n# In a build script\necho \"Collecting build artifacts...\"\n./CopyFlatten \"/build/output\" \"/artifacts/binaries\" \"*.dll\"\n./CopyFlatten \"/build/output\" \"/artifacts/executables\" \"*.exe\"\n```\n\n## File Pattern Examples\n\n| Pattern | Matches |\n|---------|---------|\n| `*.dll` | All DLL files |\n| `*.exe` | All executable files |\n| `*.txt` | All text files |\n| `*.config` | All configuration files |\n| `*.*` | All files with extensions |\n| `MyApp.*` | All files starting with \"MyApp\" |\n| `*.log` | All log files |\n| `test*.cs` | C# files starting with \"test\" |\n\n## Important Notes\n\n### File Overwrites\n- **Files with the same name will be overwritten** in the destination\n- The last file processed (alphabetically) will be the final version\n- Consider this when flattening directories with duplicate filenames\n\n### Name Conflicts\nIf multiple files have the same name but are in different source directories:\n```\nSource/\n├── Folder1/config.xml  ← This will be overwritten\n└── Folder2/config.xml  ← This will be the final file\n```\n\nOnly the last `config.xml` processed will remain in the destination.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folivegamestudio%2Fcopyflatten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folivegamestudio%2Fcopyflatten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folivegamestudio%2Fcopyflatten/lists"}