Thursday, November 30, 2017

centos - strange linux zip command behaviour



I run this on my CentOs box:



zip -r backup.zip /home/user/domains/example.com/public_html/


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/example.com/public_html/. Does anyone know how to prevent this?


Answer



That looks like expected behavior, not strange behavior.



To get what you want, try this:



cd /home/user/domains/example.com
zip -r /srv/backups/example.com/backup.zip public_html


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...