Compressing only files using 7z without preserving the path

前端 未结 5 674
梦谈多话
梦谈多话 2021-02-03 18:57

I am using 7z command line executable to zip files, but I see that while adding to an archive the path of the files is preserved in the archive.

So if I do



        
5条回答
  •  伪装坚强ぢ
    2021-02-03 19:53

    Give the full path. That should work. Not the relative path from the current location. For example, I give the below, where I want the files in the man5 folder to be archived.

    $ 7z a -tzip myzip.zip /home/pradeeban/Desktop/man4/man5/*
    

    The zip contained only the files, without the directories.

    Then I gave only the relative path. It had the directories, inside the zip.

    $ 7z a -tzip myzip.zip Desktop/man4/man5/*
    

    Tried with Linux (Ubuntu 12.04). Not sure whether that differs from Windows.

提交回复
热议问题