using find to check file of that extension exists in bash code example Example: if file has extension bash if [[ ${file: -3} == ".gz" ]]