cpx icon indicating copy to clipboard operation
cpx copied to clipboard

How to copy dir?

Open corysimmons opened this issue 9 years ago • 8 comments

corysimmons avatar Apr 15 '17 23:04 corysimmons

Thank you for the question.

Directories which have some content files will be copied automatically. If you want to copy empty directories, use --include-empty-dirs option.

mysticatea avatar Apr 17 '17 07:04 mysticatea

cpx src dist doesn't work?

corysimmons avatar Apr 17 '17 12:04 corysimmons

Currently, no. I have designed this tool to copy specific files as companion to transpilers. I had not thought copying directories. The feature would be useful.

mysticatea avatar Apr 18 '17 11:04 mysticatea

No problem. For anyone else stumbling upon this in the interim (or if you want to borrow some code) https://www.npmjs.com/package/ncp can do this.

Thanks for your work @mysticatea

corysimmons avatar Apr 18 '17 12:04 corysimmons

i have an idea !

cpx "favicons/**/*.*" ./dest

target

android-chrome-144x144.png android-chrome-192x192.png android-chrome-36x36.png android-chrome-48x48.png android-chrome-72x72.png android-chrome-96x96.png apple-touch-icon-114x114-precomposed.png apple-touch-icon-114x114.png apple-touch-icon-120x120-precomposed.png apple-touch-icon-120x120.png apple-touch-icon-144x144-precomposed.png apple-touch-icon-144x144.png apple-touch-icon-152x152-precomposed.png apple-touch-icon-152x152.png apple-touch-icon-180x180-precomposed.png apple-touch-icon-180x180.png apple-touch-icon-57x57-precomposed.png apple-touch-icon-57x57.png apple-touch-icon-60x60-precomposed.png apple-touch-icon-60x60.png apple-touch-icon-72x72-precomposed.png apple-touch-icon-72x72.png apple-touch-icon-76x76-precomposed.png apple-touch-icon-76x76.png apple-touch-icon-precomposed.png apple-touch-icon.png browserconfig.xml favicon-160x160.png favicon-16x16.png favicon-196x196.png favicon-32x32.png favicon-48x48.png favicon-96x96.png favicon.ico manifest.json mstile-144x144.png mstile-150x150.png mstile-310x150.png mstile-310x310.png mstile-70x70.png

however, this is not perfect... its without filename extension

ex) readme

harapeko avatar Feb 02 '18 06:02 harapeko

this works fine for me, without configuring file extensions. packages folder has 4-5 more folders, with different files in them. not sure if this was the exact question.

"scripts": {
    "start": "yarn watchChanges",
    "watchChanges": "cpx \"packages/**\" \"web/src\" --watch & cpx \"packages/**\" \"mobile/src\" --watch"
  }

lunatolun avatar Aug 27 '20 09:08 lunatolun

following works for me:

cpx "icons/**" build/icons && ..

steelx avatar May 11 '21 07:05 steelx

I need this and I also think adding this feature would be great.

P.S. for future readers: I achieved it like this (notice how the assets directory has been copied):

  "scripts": {
    "dev": "concurrently \"npx cpx src/static/**/* dist --watch\" \"npx cpx manifest.json dist --watch\" \"npx cpx assets/**/* dist/assets\" \"npx tsc --watch\""
  },

aderchox avatar Jul 05 '22 05:07 aderchox