Skip to content

Instantly share code, notes, and snippets.

@NewGyu
Created March 16, 2020 07:59
Show Gist options
  • Save NewGyu/b3720bed1e430a259271ff10c2b10b4c to your computer and use it in GitHub Desktop.
Save NewGyu/b3720bed1e430a259271ff10c2b10b4c to your computer and use it in GitHub Desktop.

普通は

$ zip zipfilename -r ./dist

だけどこの場合、下記の感じで指定したディレクトリ名も入っちゃう

$ zip -Tv zipfilename.zip 
Archive:  zipfilename.zip
    testing: dist/                    OK
    testing: dist/favicon.ico         OK
    testing: dist/index.html          OK
    testing: dist/README.md           OK
    testing: dist/.nojekyll           OK
    testing: dist/ddd.zip             OK
    testing: dist/200.html            OK
    testing: dist/_nuxt/              OK
    testing: dist/_nuxt/c185ea02b889bae10581.js   OK
    testing: dist/_nuxt/LICENSES      OK
    testing: dist/_nuxt/f2fb53ee09e9cc403a66.js   OK
    testing: dist/_nuxt/37b091651e97a998ecec.js   OK
    testing: dist/_nuxt/042bffd5de06a06f3e94.js   OK
    testing: dist/_nuxt/83a9bff889bc13a186a1.js   OK
    testing: dist/_nuxt/b73f755bbc7735aa9f94.js   OK
    testing: dist/_nuxt/b31fb834aae7f4482fd2.js   OK

ルートディレクトリを含めたくない場合、

$ cd dist && zip -r - . > ../zipfilename.zip
  adding: favicon.ico (stored 0%)
  adding: index.html (deflated 64%)
  adding: README.md (deflated 40%)
  adding: .nojekyll (stored 0%)
  adding: ddd.zip (stored 0%)
  adding: 200.html (deflated 64%)
  adding: _nuxt/ (stored 0%)
  adding: _nuxt/c185ea02b889bae10581.js (deflated 68%)
  adding: _nuxt/LICENSES (deflated 52%)
  adding: _nuxt/f2fb53ee09e9cc403a66.js (deflated 51%)
  adding: _nuxt/37b091651e97a998ecec.js (deflated 38%)
  adding: _nuxt/042bffd5de06a06f3e94.js (deflated 86%)
  adding: _nuxt/83a9bff889bc13a186a1.js (deflated 56%)
  adding: _nuxt/b73f755bbc7735aa9f94.js (deflated 36%)
  adding: _nuxt/b31fb834aae7f4482fd2.js (deflated 66%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment