Selectively zip files and folders

From the command line, you can pass the zip command the -xi flag to selectively specify a list of files and folders to put into a single archive.

So, say you have the following files/folders:

+ testdir 

And you want all these in an archive called “” except for index.html and ignore.txt, this would be the command:

$ zip -r9 -xi random.txt test.php testdir

This creates (maximum compression level of 9, r for recursive to go down into subdirectories) with the requested files and folders in it. Very handy!

You can test the result with unzip -l (-l = list).