When creating a backup using rsync --include-from=inclusion-file, the inclusion file supports wildcards, so you can put + .*rc to include all resource files in your home directory, for example.

Zip also supports inclusion files, but wildcards fail to work, so you have to enter every single filename. (I would almost say this is a bug, or weird shortcoming. Can someone shed some light?)

$ cat files
$ ls .*rc
.ackrc  .bashrc  .mailrc
$ zip -@ out < files
    zip warning: name not matched: .*rc

Does anyone know how to make wildcards work? The only workaround I can think about is to put the wildcard patterns on the command line itself, eg. zip -@ out < files *.rc.

The question stands for all UNIX archiving tools. Zip is preferred, but not a requisite.


7z (from 7-zip) will use wildcards in the list file (and can create ZIP-format files, in addition to its own).


You seem to be right in your assessment of zip's option -@ requiring literal filenames. The documentation I have goes on to say:

Under Unix, this option can be used to powerful effect in conjunction with the find (1) command. For example, to archive all the C source files in the current directory and its subdirectories:

find . -name "*.[ch]" -print | zip source -@

Could this be enough for your needs? In the simple case where you want to archive all files from the current directory matching .*rc, just zip out .*rc should do (as you mentioned); if you need to consider all such files recursively in subfolders, adapting the above find command could do:

find . -name '.*rc' | zip -@ out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.