Compressing only files using 7z without preserving the path

前端 未结 5 689
梦谈多话
梦谈多话 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:40

    I discovered a way to do this by using a relative path:

    7z a -tzip  myzip.zip %CD%\dir1\dir2\*
    

    %CD% is how you get the current path in a Windows batch file, but it also works from the command line. More info about Capturing the current directory from a batch file.

提交回复
热议问题