This commit is contained in:
2025-05-02 22:22:10 +00:00
commit 51c616f9f0
52 changed files with 2934 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#!/bin/bash
set -e
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then
echo "bad args" >&2
exit 1
fi
DEST=$(realpath "$2")
cd "$1"
#shellcheck disable=SC2016
find . \
-type f \
-not -path '*/.*' \
-path "$3" | \
xargs -0 -d \\n -n 1 sh -c "mkdir -p $DEST/\$(dirname \"\$1\")" sh
#shellcheck disable=SC2016
find . \
-type f \
-not -path '*/.*' \
-path "$3" \
-printf "$(pwd)/%P\n$DEST/%P\n" | \
xargs -0 -d \\n -n 2 sh -c "$4" sh
#for rel in $(find . -type f -name *.gpg); do
# DESTFILE=$(echo $DEST/$rel | sed 's/\.[^.]*$//')
# [ -f "$DESTFILE" ] && continue
# mkdir -p "$(dirname "$DESTFILE")"
# gpg --output "$DESTFILE" --decrypt "$rel"
#done