Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify Destination Directory for 'zip' Command Output (The Zip file that is Created)

Tags:

linux

unix

zip

The zip command generally places the output zip file in the current directory. But, I'm wondering if there is an option that I'm overlooking in the man page that lets me specify the destination directory for the output archive file.

This created 'my_archive' in the current directory:

zip -rT my_archive dir_to_be_archived

But, I want to be able to place 'my_archive' under ./my_backups without having to 'cd' into that backups directory. Is there something like:

zip -rt my_archive dir_to_be_archived --destination ./my_backups
like image 940
nemo Avatar asked Jul 10 '12 23:07

nemo


1 Answers

You can specify the destination path directly:

zip -r /path/to/destination.zip /files

Keep in mind that the destination should not be in the same directory as the files that you are zipping up.

like image 75
Michael Hampton Avatar answered Sep 21 '22 12:09

Michael Hampton