Compressing only files using 7z without preserving the path

Raam picture Raam · May 25, 2012 · Viewed 39.6k times · Source

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

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

the archive myzip.zip will contain the path dir1\dir2. I do not want this, rather I want only the files to be added to the zip file without the paths being preserved. I searched quite a bit but do not seem to find any way of doing this, maybe I am missing something obvious?

Thanks

Answer

Nickolay Olshevsky picture Nickolay Olshevsky · Oct 24, 2012

Just add a dot before the path, i.e. 7z a -tzip -r myzip.zip .\Relative\Dir\*