#! /bin/bash # Place this script in a directory containing many directories, say dir1, dir2, .... # This script goes into each directory, to remove all *.dat files. # Modify the suffix *.dat to remove other file type. # Be reminded that all the *.dat, including the desired one, will also be removed indiscriminately. find . -type f -name "*.dat" -print| while read obj do echo 'removing' $obj rm $obj done # end script