]> scripts.mit.edu Git - wizard.git/blob - bin/preserve-empty-dir
Object-orient the code, and add --count-exists functionality.
[wizard.git] / bin / preserve-empty-dir
1 #!/bin/bash -e
2
3 if [[ "$1" = "" ]]
4 then
5     echo "Usage: $0 directory"
6     echo "Adds a .preserve-dir file to all empty directories"
7     exit 1
8 fi
9
10 find "$1" -type d -empty -not -path "*/.git/*" -printf "%p/.preserve-dir\0" \
11     | xargs -0 -r touch
12