I want to decrypt a bunch of files using , then re-encrypt them back with a different key.

There are _at least_ a dozen files.

How do I automate this? 🤔

@celia assuming all your encrypted files are in the current directory and end in .gpg:

files=(*.gpg) for f in "${files[@]}"; do gpg --decrypt $f --output "${f%%.gpg}" # strip the .gpg extension done

similarly, run gpg --encrypt my_recipient filename --out filename.gpg for each file. this needs bash, by the way. dunno if it works in any other shell (zsh could work).

@celia also, i’d suggest backing up your directory of files before running any scripts on them, heh. i’ve had my files ruined before thanks to my shitty scripts.

@x That is absolutely a part of my plan. :D

I'd be super, super upset if I lost these files. 😂

@x Gonna try this after work today! Amazing, thank you! 😊

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.