summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/dir.sh15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/dir.sh b/lib/dir.sh
index f6b6710..c49469d 100644
--- a/lib/dir.sh
+++ b/lib/dir.sh
@@ -26,6 +26,9 @@ dir_is_empty()
local dir="${1}"
local ret=
local dirent=
+ local exclude=
+ local exclusion=
+ shift 1
ret=0
@@ -36,7 +39,17 @@ dir_is_empty()
# .??* dirents whose names start with "." and are three or more
# characters long
for dirent in "${dir}/"* "${dir}/".[!.] "${dir}/".[!.] "${dir}/".??*; do
- if [ -e "${dirent}" ]; then
+ if ! [ -e "${dirent}" ]; then
+ continue
+ fi
+ exclude=false
+ for exclusion in "${@}"; do
+ if [ "x${dirent##*/}" = "x${exclusion}" ]; then
+ exclude=true
+ break
+ fi
+ done
+ if ! ${exclude}; then
ret=1
break
fi