strange linux zip command behaviour

user146526 asked:

I run this on my CentOs box:

zip -r /home/user/domains/

The command works ok as it should, but I have an annoying problem.

What I expect is when I open the zip to have one folder in it: public_html

Instead i have /home/user/domains/ Does anyone know how to prevent this?

My answer:

That looks like expected behavior, not strange behavior.

To get what you want, try this:

cd /home/user/domains/
zip -r /srv/backups/ public_html

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.