#!/bin/bash rootpath="$(pwd)/.." rootpath=$(builtin cd $rootpath; pwd) cd ${rootpath} echo ${rootpath} to_remove="*~* *._* *.DS_Store" for filepattern in $to_remove; do echo ${filepattern} find . -name ${filepattern} -delete done