summaryrefslogtreecommitdiff
path: root/jni/ruby/tool/rmdirs
diff options
context:
space:
mode:
Diffstat (limited to 'jni/ruby/tool/rmdirs')
-rwxr-xr-xjni/ruby/tool/rmdirs11
1 files changed, 11 insertions, 0 deletions
diff --git a/jni/ruby/tool/rmdirs b/jni/ruby/tool/rmdirs
new file mode 100755
index 0000000..6dcf984
--- /dev/null
+++ b/jni/ruby/tool/rmdirs
@@ -0,0 +1,11 @@
+#!/bin/sh
+for dir do
+ while rmdir "$dir" >/dev/null 2>&1 &&
+ parent=`expr "$dir" : '\(.*\)/[^/][^/]*'`; do
+ case "$parent" in
+ . | .. | "$dir") break;;
+ *) dir="$parent";;
+ esac
+ done
+done
+true