【问题标题】:UNIX: how to zip a folder that contains more folders w/o including any of the folder pathsUNIX:如何压缩包含更多文件夹但不包含任何文件夹路径的文件夹
【发布时间】:2020-04-30 16:50:18
【问题描述】:

我正在尝试压缩包含一些 .json 文件以及包含更多 .json 文件的子文件夹的文件夹。我需要压缩包含所有内容的父文件夹,而不包含任何父文件夹或子文件夹路径。有什么办法可以做到吗?

谢谢

编辑:

我想要这个:

 pending_provider/722c9cb2-268b-4e4a-9000-f7f65e586011-version/1d296136-ac87-424e-89c4-682a63c7b853.json (deflated 68%)

但不是这个:

pending_provider/722c9cb2-268b-4e4a-9000-f7f65e586011-version/ (stored 0%)

我想避免只保存文件夹路径的“stor”压缩类型。我只想要“defN” 所以 -j 对我帮助不大

谢谢

【问题讨论】:

    标签: unix zip


    【解决方案1】:

    如果您根本不想要任何路径,您可以使用-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).
    

    如果你只想排除目录

       -D
       --no-dir-entries
              Do not create entries in the zip archive for directories. 
    

    【讨论】:

    • 感谢您的回答。我试过这个,但它把我所有的文件都存储在同一个文件夹中。我需要有 /folder/file 路径,而不是 /folder 路径。更具体地说(我编辑我的帖子)
    • 这能满足您的需求吗? superuser.com/questions/312301/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-11
    • 1970-01-01
    相关资源
    最近更新 更多