For example in data directory I have files like CODE_A1_timestamp.txt, CODE_A2_timestamp.txt and DOCI_A1_Timestamp.txt. I only need to zip files with pattern CODE_A1* i.e. CODE_A1_timestamp.txt file before moving it to archive directory.

1 Answer 1


zip only

Include only the specified files, as in:

zip foo . -i CODE_A1\*

find and zip

You can use find with not-recursive-option (-maxdepth 1) like:

find . -maxdepth 1 -name 'CODE_A1*' | zip foo -@

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .