1

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

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 -@

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.