3

I'm trying to run the following command:

webpack &&
    cp -r i18n build/i18n &&
    cp -r core build/core &&
    cp -r views build/views &&
    cp -r styles build/styles &&
    find ./components -iname \"*.html\" -exec rsync -R '{}' ./build/ \\;

and it is returning following error message:

find: missing argument to `-exec'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tracker-capture-app@26.0.10 build: `webpack && cp -r i18n 
build/i18n && cp -r core build/core && cp -r views build/views && cp -r 
styles build/styles && find ./components -iname "*.html" -exec echo '{}' 
./build/ \;`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tracker-capture-app@26.0.10 build script 'webpack && 
cp -r i18n build/i18n && cp -r core build/core && cp -r views build/views && 
cp -r styles build/styles && find ./components -iname "*.html" -exec echo 
'{}' ./build/ \;'.
wjandrea
  • 14,236
  • 4
  • 48
  • 98

1 Answers1

3
  1. The first syntax error I noticed is \\;. It should be \;, which is a literal semicolon ; to end the -exec statement.

  2. The directory needs​ a trailing slash, so that find looks inside of it.

  3. And, as @steeldriver mentioned, \"*.html\" should be just "*.html", unless you're looking for html files with quotes in their filenames.

So, in full:

find ./components/ -iname "*.html" -exec rsync -R '{}' ./build/ \;
wjandrea
  • 14,236
  • 4
  • 48
  • 98
  • 2
    I suspect the \"*.html\" is over-escaped as well – steeldriver Apr 18 '17 at 17:17
  • i tried using this :-find ./components -iname ".html" -exec rsync -R '{}' ./build/ ;...........it says :-skipping directory . and i even tried using:- find ./components -iname ".html" -exec rsync -R ./build/ ; .....:- but unable to build html pages in my component folder – Sudiksha Nagvanshi Apr 21 '17 at 14:52
  • @SudikshaNagvanshi Ah, the directory needs a trailing slash. I updated my answer. BTW, you can use backticks in comments for code formating. – wjandrea Apr 21 '17 at 16:10
  • it give me an error :$ npm run build npm ERR! file E:\nodejs\prac\111\package.json npm ERR! code EJSONPARSE npm ERR! Failed to parse json npm ERR! Unexpected token '.' at 9:160 npm ERR! ld/views && cp -r styles build/styles && find ./components/ -iname "*.html" -ex npm ERR! ^ npm ERR! File: E:\nodejs\prac\111\package.json npm ERR! Failed to parse package.json data. – Sudiksha Nagvanshi Apr 21 '17 at 16:22
  • That's not the same command. – wjandrea Apr 21 '17 at 16:34