我需要使用以下命令创建一个 zip 文件:
zip /dir/to/file/newZip /data/to/zip/data.txt
这可行,但创建的 zip 文件会创建一个目录结构,该目录结构模仿原始文件的目录。这是很多我不需要的额外文件夹。
粗略浏览一下手册页或 Google 搜索,我都没有找到答案。
最佳答案
你可以使用-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).
https://stackoverflow.com/questions/9710141/