summaryrefslogtreecommitdiff
path: root/jni/ruby/tool/rmdirs
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/tool/rmdirs
Fresh start
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