• 请不要在回答技术问题时复制粘贴 AI 生成的内容
MLawliet
V2EX  ›  程序员

7z 命令行如何添加一个文件到一个压缩包的指定文件夹

  •  
  •   MLawliet · Aug 5, 2020 · 2787 views
    This topic created in 2195 days ago, the information mentioned may be changed or developed.
    已存在一个压缩包 1.zip ,其中有个子目录叫 d, 现外部有一个 1/2/3/a.txt 想用命令行添加到 d 文件夹内,如何实现?
    查了好久没找到合适方案

    目前想到的方案是先把 a.txt 放到 zip 更目录,再重命名
    > 7z a 1.zip ./1/2/3/a.txt
    > 7z rn 1.zip a.txt d/a.txt

    不知道有没有一步到位的方法~
    2 replies    2020-08-05 13:16:42 +08:00
    iamwho
        1
    iamwho  
       Aug 5, 2020
    add 再 rename 已经是最优解了,对于 7z 来说。

    可以写个脚本操作啊。
    vonsy
        2
    vonsy  
       Aug 5, 2020
    https://sourceforge.net/p/sevenzip/discussion/45798/thread/5856d980/
    Now there is no option for that task.
    You can use additional "rn" (Rename) command to rename folder inside archive.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   869 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:44 · PVG 03:44 · LAX 12:44 · JFK 15:44
    ♥ Do have faith in what you're doing.