]> scripts.mit.edu Git - wizard.git/commitdiff
Initial commit.
authorEdward Z. Yang <edwardzyang@thewritingpot.com>
Sun, 17 May 2009 23:19:32 +0000 (19:19 -0400)
committerEdward Z. Yang <edwardzyang@thewritingpot.com>
Sun, 17 May 2009 23:19:32 +0000 (19:19 -0400)
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
bin/preserve-empty-dir [new file with mode: 0755]

diff --git a/bin/preserve-empty-dir b/bin/preserve-empty-dir
new file mode 100755 (executable)
index 0000000..ea06ffc
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+
+if [[ "$1" = "" ]]
+then
+    echo "Usage: $0 directory"
+    echo "Adds a .preserve-dir file to all empty directories"
+    exit 1
+fi
+
+find "$1" -type d -empty -not -path "*/.git/*" -printf "%p/.preserve-dir\0" \
+    | xargs -0 -r touch
+