I am trying to write a script that remove files ending .csv from an input folder. I try to write this:
# the direction path of the folder
dirPath="$1"
# remove the files ending .csv
find $dirPath -type f -name "*.csv" | while read filename; do
rm "$filename"
done
But it's not working, how can we fix it?