#!/bin/bash #This script recursively travels the path provided #and removing files from the directory tree. #This script should only be used to clean up a directory tree # #David Welsh #April 26, 2005 #Set the path export PATH=$HOME/bin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin #Check that there is one arguement if [ $# = 1 ]; then #change to the passed in directory cd $1 echo Removing files in "$1" #loop over the files in this directory. #If the file is a directory # then call this script again with the directory name # else remove the file for f in * do if [ -d "$f" ]; then if [ -x "$f" ]; then RemoveData.bash "$f" fi else /bin/rm "$f" fi done else echo Usage: RemoveData.bash dir fi