Zipping all files/dirs in a directory except hidden ones?

This works for me:

zip -r mydir.zip mydir -x "*/.*"

@Joe Internet, @Dariusz: normal shell patterns won't work properly because zip matches against the full path+filename internally (as the zip manual explains... ;) )


Shorter, and takes advantage of the features of globbing:

zip -r mydir.zip mydir/*

(. files are not included in the * wildcard)

Note that the directory 'mydir/' may not be included in the paths of the files in the resultant zip file, so this will change the output slightly. You may have to change your extraction process as a result.