To iterate over all directories under $MYDIR
,
find "$MYDIR" -type d |
while read dir; do
printf '%s\n' "Deleting files in <$dir>"
rm -f "$dir"/*
done
Note that you must double quote the dir
variable when using it to prevent the shell from performing word-splitting at spaces.
Skipping $MYDIR
if you don't need it left as an exercise.