2

I have a directory called Klox with whats of files and images.

Klox is located in ~/Projects/Klox

When I use zip -r Klox.zip ~/Projects/Klox the archive is containing all the directories until reaching Klox. /home/vk/projects/Klox

I want the zip file to contain only the Klox folder. So people don't have to open home folder, then open vk folder then open projects and finally open Klox

1 Answers1

6

The zip utility stores paths relative to the current working directory, so you have to use cd or pushd/popd to go to ~/Projects first:

cd ~/Projects
zip -r Klox.zip Klox

or when you want to return to the original working directory afterwards:

pushd ~/Projects
zip -r Klox.zip Klox
popd
JanC
  • 19,802