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)
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024