Skip to content

Instantly share code, notes, and snippets.

@zapirkon
Created September 21, 2019 22:28
Show Gist options
  • Save zapirkon/6621181b0b528b8b1d921769601aba1f to your computer and use it in GitHub Desktop.
Save zapirkon/6621181b0b528b8b1d921769601aba1f to your computer and use it in GitHub Desktop.
Copying entire folders or pulling files in single folder using node modules cpy and copyfiles
1. Copy files from anywhere in folder tree to flat folder:
copyfiles -f source-folder/**/subfolder/*.ts destination/ts
or
cpy source-folder/**/subfolder/*.ts destination/ts
2. Copy all folder contents. If source and destination are on same level and we want to copy contents from source to destination:
copyfiles source/**/* destination/
or
cpy --parents --cwd=source ** ../destination
When using cpy, cwd is set to source, so we need to find destination one folder before source (if we use relative path for destination)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment