To backup my document root (/var/www/html/
I can execute):
zip -r ~/backups/all_zipped-$(date +\%F-\%T).zip /var/www/html/
The problem is that inside the created zip file, I get 3 base directories instead of 1:
var
.www
.html
.
The desired end state is to have only 1 base directory (the last one). In this case, of course, html
(and its inodes).
Using zip -r ~/backups/all_zipped-$(date +\%F-\%T).zip /var/www/html/*
(note the *
), didn't help.
How to zip current directory without its entire path?
unzip -l ~/backups/all_zipped-$(date +\%F-\%T).zip
to your question. If necessary, reduce the number of lines to the important lines. – Cyrus Jan 28 '18 at 09:14