Skip to content

Instantly share code, notes, and snippets.

@caiofaustino
Created Mar 16, 2021
Embed
What would you like to do?
Sign all files in folder recursively
#!/bin/bash
echo "Starting sign script"
script_path="/your/script/path/sign.sh"
if [ -d "$1" ]; then
echo "Path exists!"
for f in $1/*; do
if [[ $f == *"."[a-z][a-z][a-z] ]]; then
filename=$(basename "$f")
echo "Signing file - $filename"
gpg -ab --default-key <your_key> $f
else
echo "Starting script again with: $f"
$script_path "$f"
fi
done
else
echo "Path not found, please provide valid path as argument!"
fi
echo "Signing finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment