本文介绍了创建zip文件并忽略目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用以下命令创建一个zip文件:

I need to create a zip file using this command:

zip /dir/to/file/newZip /data/to/zip/data.txt

这可行,但是创建的zip文件会创建一个目录结构,将目录模仿为原始文件.我不需要很多额外的文件夹.

This works, but the created zip file creates a directory structure mimicking the directory to the raw file. It is a lot of extra folders that I don't need.

我没有粗略浏览手册页或Google搜索的答案.

I didn't find an answer in a cursory glance over the man page or a Google hunt.

推荐答案

您可以使用-j.

-j
--junk-paths
          Store just the name of a saved file (junk the path), and do  not
          store  directory names. By default, zip will store the full path
          (relative to the current directory).

这篇关于创建zip文件并忽略目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 06:20
查看更多