Linux: how to zip files based on a find pattern

Scenario

We need to find all csv files in a directory, compress them to single zip file, and finally delete the csv files.

Solution

find ./report -maxdepth 1 -name '*.csv' | zip ./report/report.zip -m@

The find command returns the first level of directory ./report all files that matches *.csv pattern, then zip command appends each file to the ./report/report.zip file, -m parameter deletes the csv file after compression.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store