rajeshkumar created the topic: Shell script for recursive delete required.
#!/bin/bash
if [ $# -ne 1 -o ! -d "$1" ]
then
echo "Usage $0 dirname"
exit 1
fi
find "$1" -type f -print | while read file
do
dir=$(dirname "$file")
dname=$(basename "$dir")
fname=$(basename "$file")
[ "$dname" = "$fname" ] && rm "$file"
done
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn
Latest posts by Rajesh Kumar (see all)
- An Introduction of GitLab Duo - December 22, 2024
- Best Hospitals for affordable surgery for medical tourism - December 20, 2024
- Top Global Medical Tourism Companies in the World - December 20, 2024