How to zip only files with specific extension

Posted on December 9, 2019

While I was connected in server through ssh, i wanted to download only the images from a path.

The following line will search for all files in the current path that include .gif in their name then zip them.

find . -type f -name "*.gif" -print | zip ~/gifs.zip -@

The search also includes the subfolders.