From 631e6abbfd1f129ca50fcbdc066bbafeaefcb18b Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Mon, 23 Nov 2020 23:00:05 +0100 Subject: [PATCH] Skip hidden files in consumedir --- tools/consumedir.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/consumedir.sh b/tools/consumedir.sh index e15faae6..b0df9abb 100755 --- a/tools/consumedir.sh +++ b/tools/consumedir.sh @@ -354,13 +354,13 @@ checkSetup() { checkSetup if [ "$once" = "y" ]; then - info "Uploading all files in '$watchdir'." + info "Uploading all files (except hidden) in '$watchdir'." MD="-maxdepth 1" if [ "$recursive" = "y" ]; then MD="" fi for dir in "${watchdir[@]}"; do - find "$dir" $MD -type f -print0 | while IFS= read -d '' -r file; do + find "$dir" $MD -type f -not -name ".*" -print0 | while IFS= read -d '' -r file; do process "$file" "$dir" done done @@ -371,9 +371,13 @@ else fi $INOTIFY_CMD $REC -m --format '%w%f' -e close_write -e moved_to "${watchdir[@]}" | while read pathfile; do - dir=$(findDir "$pathfile") - trace "The file '$pathfile' appeared below '$dir'" - sleep 1 - process "$(realpath "$pathfile")" "$dir" + if [[ "$(basename "$pathfile")" != .* ]]; then + dir=$(findDir "$pathfile") + trace "The file '$pathfile' appeared below '$dir'" + sleep 1 + process "$(realpath "$pathfile")" "$dir" + else + trace "Skip hidden file $(realpath "$pathfile")" + fi done fi