简体   繁体   English

zip 父目录中的文件和文件夹,不包括父目录 + Amazon Linux

[英]zip the files and folders inside a parent directory without including the parent directory + Amazon Linux

Is there a Linux command to zip the files and folders inside a parent directory without including the parent directory.是否有 Linux 命令到 zip 父目录中的文件和文件夹而不包括父目录。 From all the solutions that I tried, the parent directory also is getting zipped从我尝试过的所有解决方案中,父目录也被压缩了

Move into the folder, then zip:移动到文件夹中,然后是 zip:

cd my-folder
zip -r ../my-archive.zip *

Dirty, but effective肮脏,但有效

Or, in a more fancy way, using tar :或者,以更奇特的方式使用tar

tar czf my-archive.tar.gz -C /path/to/my-foder/ ./

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM