find /i-data/md0/video/ -type d -empty -delete # print files/directories with size less 1M: cd /********/Videos/couchpotato-complete du -sh * | grep -P "\d+K" | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}' | sort du -sh * | grep -P "\d+K" | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}' | sort > movies_to_delete.txt while read -r file; do rm -rv -- "$file"; done < movies_to_delete.txt rm -v movies_to_delete.txt
One thought on “Recursively remove all empty or almost empty directories”
Leave a Reply
You must be logged in to post a comment.
I got this website from my friend who informed me regarding
this website and now this time I am browsing this site and
reading very informative articles here.