diff --git a/lib/filefct.sh b/lib/filefct.sh index effefb8..ce8e9a3 100644 --- a/lib/filefct.sh +++ b/lib/filefct.sh @@ -108,4 +108,30 @@ installfile() } export -f installfile + +# ------------------------------------------------------------------------------ +# determine if a directory is empty +isdirempty() +{ + dir=$1 + + if [[ ! -d $dir ]]; then + return 0 + fi + + nbfiles=$(ls -a1 $dir | egrep -v '^.$|^..$' | wc -l) + if [[ $nbfiles -eq 0 ]]; then + return 0 + fi + return 1 +} + + +# ------------------------------------------------------------------------------ +# patch a file replacing all @var@ by the corresponding value in environment +patchfile() +{ + : # todo +} + # EOF