{"id":22897276,"url":"https://github.com/center-key/copy-folder-util","last_synced_at":"2025-12-28T12:10:36.808Z","repository":{"id":59728178,"uuid":"538732079","full_name":"center-key/copy-folder-util","owner":"center-key","description":"📂 Recursively copy a folder (CLI for package.json scripts)","archived":false,"fork":false,"pushed_at":"2025-04-20T07:13:47.000Z","size":907,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T22:06:36.257Z","etag":null,"topics":["cli","command-line","copy","directory","folder","npm","recursive","script"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/center-key.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-09-19T23:23:48.000Z","updated_at":"2025-04-20T07:13:50.000Z","dependencies_parsed_at":"2024-06-21T04:17:44.932Z","dependency_job_id":"c70f4e13-39f8-4ba8-84b7-aab22f3fd87b","html_url":"https://github.com/center-key/copy-folder-util","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"be7fd2f14d1e63c88acf9ebd9e9b98d17a6e40c0"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/center-key%2Fcopy-folder-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/center-key%2Fcopy-folder-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/center-key%2Fcopy-folder-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/center-key%2Fcopy-folder-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/center-key","download_url":"https://codeload.github.com/center-key/copy-folder-util/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252961837,"owners_count":21832196,"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":["cli","command-line","copy","directory","folder","npm","recursive","script"],"created_at":"2024-12-14T00:16:24.207Z","updated_at":"2025-12-28T12:10:36.783Z","avatar_url":"https://github.com/center-key.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# copy-folder-util\n\u003cimg src=https://centerkey.com/graphics/center-key-logo.svg align=right width=200 alt=logo\u003e\n\n_Recursively copy files from one folder to another folder (CLI tool designed for use in npm package.json scripts)_\n\n[![License:MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/center-key/copy-folder-util/blob/main/LICENSE.txt)\n[![npm](https://img.shields.io/npm/v/copy-folder-util.svg)](https://www.npmjs.com/package/copy-folder-util)\n[![Build](https://github.com/center-key/copy-folder-util/actions/workflows/run-spec-on-push.yaml/badge.svg)](https://github.com/center-key/copy-folder-util/actions/workflows/run-spec-on-push.yaml)\n\n**copy-folder-util** takes a source folder and copies its files and subfolders to a new destination.\u0026nbsp;\nThe command's console output includes a timestamp and formatting helpful in build systems.\n\n\u003cimg src=https://raw.githubusercontent.com/center-key/copy-folder-util/main/screenshot.png\nwidth=800 alt=screenshot\u003e\n\n## A) Setup\nInstall package for node:\n```shell\n$ npm install --save-dev copy-folder-util\n```\n\n## B) Usage\n### 1. Synopsis\n```\ncopy-folder [SOURCE] [TARGET]\n```\nParameters:\n* The **first** parameter is the *source* folder.\n* The **second** parameter is the *target* folder.\n\n### 2. npm package.json scripts\nRun `copy-folder` from the `\"scripts\"` section of your **package.json** file.\n\nExample **package.json** scripts:\n```json\n   \"scripts\": {\n      \"make-dist\": \"copy-folder build dist\",\n      \"make-docs\": \"copy-folder src/web --ext=.html docs/api-manual\"\n   },\n```\n\n### 3. Command-line npx\nExample terminal commands:\n```shell\n$ npm install --save-dev copy-folder-util\n$ npx copy-folder src/web ext=.html docs/api-manual\n```\nYou can also install **copy-folder-util** globally (`--global`) and then run it anywhere directly from the terminal.\n\n### 4. CLI flags\nCommand-line flags:\n| Flag         | Description                                           | Value      |\n| ------------ | ----------------------------------------------------- | ---------- |\n| `--basename` | Filter files by filename ignoring the file extension. | **string** |\n| `--cd`       | Change working directory before starting copy.        | **string** |\n| `--ext`      | Filter files by file extension, such as `.js`.\u003cbr\u003eUse a comma to specify multiple extensions. | **string** |\n| `--note`     | Place to add a comment only for humans.               | **string** |\n| `--quiet`    | Suppress informational messages.                      | N/A        |\n| `--summary`  | Only print out the single line summary message.       | N/A        |\n\n### 5. Examples\n   - `copy-folder build --basename=index dist` \u003cbr\u003e\n   Only copies files with filenames matching `index.*`.\n\n   - `copy-folder -cd=spec fixtures mock1`\u003cbr\u003e\n   Copies the folder **spec/fixtures** to **spec/mock1**.\n\n   - `copy-folder build dist --summary`\u003cbr\u003e\n   Displays the summary informaion but not informaion about individual files copied.\n\n   - `copy-folder 'src/Legal Notices' dist --summary`\u003cbr\u003e\n   Copies a folder that has a space in its name.\n\n   - `copy-folder src/web --ext=.js,.html docs`\u003cbr\u003e\n   Copies only the JavaScript and HTML files to the **docs** folder.\n\n\u003e [!NOTE]\n\u003e _Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._\n\n## C) Application Code\nEven though **copy-folder-util** is primarily intended for build scripts, the package can be used programmatically in ESM and TypeScript projects.\n\nExample:\n``` typescript\nimport { copyFolder } from 'copy-folder-util';\n\nconst options = { fileExtensions: ['.html', '.js'] };\nconst results = copyFolder.cp('src/web', 'docs/api-manual', options);\nconsole.info('Number of files copied:', results.count);\n```\n\nSee the **TypeScript Declarations** at the top of [copy-folder.ts](src/copy-folder.ts) for documentation.\n\n\u003cbr\u003e\n\n---\n**CLI Build Tools for package.json**\n   - 🎋 [add-dist-header](https://github.com/center-key/add-dist-header):\u0026nbsp; _Prepend a one-line banner comment (with license notice) to distribution files_\n   - 📄 [copy-file-util](https://github.com/center-key/copy-file-util):\u0026nbsp; _Copy or rename a file with optional package version number_\n   - 📂 [copy-folder-util](https://github.com/center-key/copy-folder-util):\u0026nbsp; _Recursively copy files from one folder to another folder_\n   - 🪺 [recursive-exec](https://github.com/center-key/recursive-exec):\u0026nbsp; _Run a command on each file in a folder and its subfolders_\n   - 🔍 [replacer-util](https://github.com/center-key/replacer-util):\u0026nbsp; _Find and replace strings or template outputs in text files_\n   - 🔢 [rev-web-assets](https://github.com/center-key/rev-web-assets):\u0026nbsp; _Revision web asset filenames with cache busting content hash fingerprints_\n   - 🚆 [run-scripts-util](https://github.com/center-key/run-scripts-util):\u0026nbsp; _Organize npm package.json scripts into groups of easy to manage commands_\n   - 🚦 [w3c-html-validator](https://github.com/center-key/w3c-html-validator):\u0026nbsp; _Check the markup validity of HTML files using the W3C validator_\n\nFeel free to submit questions at:\u003cbr\u003e\n[github.com/center-key/copy-folder-util/issues](https://github.com/center-key/copy-folder-util/issues)\n\n[MIT License](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenter-key%2Fcopy-folder-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcenter-key%2Fcopy-folder-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenter-key%2Fcopy-folder-util/lists"}