Remove all empty directories

$ cleanlinks

this is supported on few flavor of Linux (XFree86), you can use this script.

#/bin/bash
DIR="$1"
[ -d $DIR ] && [ $(ls -l $DIR | wc -l) -eq 1 ] && rmdir $DIR || :


$ script.sh dir1

Comments

Anonymous said…
Find empty folder and save as temporary file
# find /path -type d -empty -exec ls -ld >> /tmp/savefiles.txt {} \;

Find empty folder and delete
# find /path -type d -empty -exec rm -rf {} \;

Popular posts from this blog

How do I Use the Linux Top Command?

IOPS measurement