#!/bin/bash for i in {1..5}; do find . -maxdepth 1 -type d|grep "Prices_2017-0${i}"|xargs tar cvf "prices_2017-0${i}.tar.xz" -I pixz; done