I have a directory and there are several files in it. I am trying to decrypt these files and move them to another directory. I cannot figure out how to set the name of the output file and move it.
So, the directory structure is as follows:
/Applications/MAMP/bin/decryptandmove.sh /Applications/MAMP/bin/passtext.txt /Applications/MAMP/bin/encrypted/test1.txt.pgp /Applications/MAMP/bin/encrypted/test2.txt.pgp /Applications/MAMP/htdocs/www/decrypted/
For all the files found in the encrypted directory, I try to decrypt them and then move them to the www / decrypted / directory. I don’t know which file names in the encrypted directory will be ahead of time (this script will ultimately be executed through the cron task), so I just wanted to output decrypted files with the same file names, but without pgp. Thus, the result will be:
/Applications/MAMP/bin/decryptandmove.sh /Applications/MAMP/bin/passtext.txt /Applications/MAMP/bin/encrypted/ /Applications/MAMP/htdocs/decrypted/test1.txt.pgp /Applications/MAMP/htdocs/decrypted/test2.txt.pgp
So that’s all I’ve written so far, and it won’t work. FILE and FILENAME are wrong. I didn’t even get to the moving part.
pass_phrase=`cat passtext.txt|awk '{print $1}'` for FILE in '/Applications/MAMP/bin/encrypted/'; do FILENAME=$(basename $FILE .pgp) gpg --passphrase $pass_phrase --output $FILENAME --decrypt $FILE done
shell encryption
Kittyyoung
source share