0

I am using zip on ubuntu 20.04 to create backup files which I then send to a backups device.

I use the following zip command : zip -r /tmp/stuff.zip /home/someone/stuff

to create a backup of the "stuff" directory. When I look at the contents of the generated zip file the leading slash has been removed from all of the zip file members. After reading the man page for zip I tried to use the "--absolute-path" option, but I received an error telling me that that option was not supported.

How can I prevent ZIP from removing the leading slash ?

1 Answer 1

0

How can I prevent ZIP from removing the leading slash ?

You can not and there are valid reasons for this. One of them the need to always check the contents 1st before extracting as you would never know up front it is has or has not a leading /.

It is hard-coded into all of those kind of tools. If you want this you will need to remove this feature from the source of "zip" and recompile it.

And there is a simple method to do what you want:

Extract the zip on any system by doing

cd /

and then do the extract command.

Mind that tar still has an option for this -P or --absolute-names. It will still default to restoring without absolute path if you restore without the option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .