#!/bin/bash for i in {2..8}; do find . -maxdepth 1 -type d|grep "Prices_2013-0${i}"|xargs tar cvJf "prices_2013-0${i}.tar.xz"; done