From 276b49ea0aa0145db1e4fed0c61e674e5a28f29f Mon Sep 17 00:00:00 2001 From: shuki Date: Fri, 6 Mar 2026 19:01:14 +0200 Subject: [PATCH] Fix include filter: also include directory contents When TARGET_INCLUDE has a directory pattern like 'embajada/', rsync would include the directory but exclude its contents (files didn't match any include rule before hitting --exclude=*). Now adds a 'pattern**' include for each directory pattern. Co-Authored-By: Claude Opus 4.6 --- lib/transfer.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/transfer.sh b/lib/transfer.sh index 172d682..9e964bf 100644 --- a/lib/transfer.sh +++ b/lib/transfer.sh @@ -188,7 +188,12 @@ transfer_folder() { for pat in "${inc_patterns[@]}"; do pat="${pat#"${pat%%[![:space:]]*}"}" pat="${pat%"${pat##*[![:space:]]}"}" - [[ -n "$pat" ]] && filter_opts+=(--include="$pat") + [[ -z "$pat" ]] && continue + filter_opts+=(--include="$pat") + # For directory patterns, also include their contents + if [[ "$pat" == */ ]]; then + filter_opts+=(--include="${pat}**") + fi done filter_opts+=(--exclude="*") # Prune empty dirs left by directory traversal