Can't quite figure out how to do this right. I have a folder with a website in /var/www

I want to create a zip file with all of it, which when I decompress it does not include the top directory. In other words, the "top" of the zip file should not be the www directory, but the files inside that directory. Hope that made sense...

Reason why I need it is because I need to upload my website as a zip file and then unzip it in place. And won't work if it then unzips to webroot/www/ instead of webroot/.

Any able to help with how to do this correctly in the terminal?

  • 1
    Which commands and arguments are you using to make the Zip? – Ƭᴇcʜιᴇ007 Oct 3 '11 at 18:40
cd /path/to/your/folder/www
zip -r filename.zip *


mv filename.zip /some/other/path
  • Will this include hidden files? – Svish Oct 3 '11 at 19:33
  • * does include hidden files. – Joshua Robinson Apr 11 '16 at 8:10
  • 1
    What if I don't want to cd to the directory first? – Trevor Sullivan Apr 21 '17 at 16:58

7z a -tzip filename.zip -w /var/www/.

Hidden files included.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.