1

Using bash on OS X 10.10 I'm zipping a folder and saving it elsewhere using this:

_now=$(date +"%Y-%m-%d-%H-%M-%S")
pushd /Users/me/Documents/local-backups/writing
zip -r /Users/me/Documents/local-backups/writing/writing-bak-$_now.zip /Users/me/Dropbox/writing
popd

However my zipped file includes all the annoying directories above "writing" (i.e., from /Users/me/Dropbox/writing).

I saw the question and answer here:

Avoid unwanted path in Zip file

... but I couldn't see how the solution there could apply to my example where directories are far apart.

GMag
  • 11

1 Answers1

0

The penny dropped. It should be:

_now=$(date +"%Y-%m-%d-%H-%M-%S")
pushd /Users/me/Dropbox
zip -r /Users/me/Documents/local-backups/writing/writing-bak-$_now.zip ./writing/
popd
GMag
  • 11