Linux命令:如何将多个文件及文件夹压缩为一个压缩文件

1、如何将多个文件及文件夹压缩为一个压缩文件

Linux命令:如何将多个文件及文件夹压缩为一个压缩文件

  问题:我要把这些文件压缩为一个压缩文件

  解决方案:linux命令 — tar命令:https://www.runoob.com/linux/linux-comm-tar.html

PS D:\nuxtrun\test> tar czvf dev.tar.gz .\nuxt.config.js .\package.json .\package-lock.json .\router.js .\static\ .\.nuxt\
a ./nuxt.config.js
a ./package.json
a ./package-lock.json
a ./router.js
tar.exe: ./static: Couldn't find file: Invalid argument
tar.exe: ./.nuxt: Couldn't find file: Invalid argument
tar.exe: Error exit delayed from previous errors.

  注意目录的话需要写通配符,否则的话就会报上面这个错。正确的应该这样:

PS D:\nuxtrun\test> tar czvf dev.tar.gz .\nuxt.config.js .\package.json .\package-lock.json .\router.js .\static\* .\.nuxt\*
a ./nuxt.config.js
a ./package.json
a ./package-lock.json
a ./router.js
a ./static/apple-app-site-association
a ./static/behavior.js
a ./static/favicon.ico
a ./static/robots.txt
a ./static/sitemap202102.xml
a ./static/wechatCode.css
a ./.nuxt/App.js
a ./.nuxt/axios.js
a ./.nuxt/client.js
a ./.nuxt/components
a ./.nuxt/empty.js
a ./.nuxt/index.js
a ./.nuxt/loading.html
a ./.nuxt/middleware.js
a ./.nuxt/router.js
a ./.nuxt/server.js
a ./.nuxt/store.js
a ./.nuxt/utils.js
a ./.nuxt/views
a ./.nuxt/views/app.template.html
a ./.nuxt/views/error.html
a ./.nuxt/components/no-ssr.js
a ./.nuxt/components/nuxt-build-indicator.vue
a ./.nuxt/components/nuxt-child.js
a ./.nuxt/components/nuxt-error.vue
a ./.nuxt/components/nuxt-link.client.js
a ./.nuxt/components/nuxt-link.server.js
a ./.nuxt/components/nuxt-loading.vue
a ./.nuxt/components/nuxt.js
PS D:\nuxtrun\test>

  然后就会在该目录下生成 dev.tar.gz 压缩文件

Linux命令:如何将多个文件及文件夹压缩为一个压缩文件

上一篇:nuxt 获取数据


下一篇:nuxt.js相关随笔