Thanks scasey,
The man page is rather overwhelming. I missed that option. This will be interesting. I have used the "find ... -exec some command {} \;" method to deal with a bunch of files in numerous directories for a long time. I have never tried using the found file expression {} for anything but telling the command what file to operate on. I will have to do some sed operation on the path and name of the input file to generate the name of the output file. I will see what I can do and post back with my success (or not).
Ken
Update: I am cooking with gas
I could not stuff the whole thing into a single "find ... exec {}" command so here is what I came up with
Code:
PASS=testpasswordfornow
for sourcefile in $(find /quitelarge/upload/proton/ -name *.gz)
do
destfile=$(echo $sourcefile | sed 's;/quitelarge/upload/proton;/quitelarge/upload/mega;')
gpg --batch --passphrase "$PASS" -o $destfile.gpg -c $sourcefile
done
If I may explain...
I will be changing my main script to write the .tar.gz files to the /quitelarge/upload/proton/ directory tree. This is on a secondary PCIe SSD. The data originates in the /data/ tree on my primary PCIe SSD. tar should run rather FAST
(and it is only a couple of GB of data total) The files to be uploaded to ProtonDrive do not need to be encrypted. Once this is complete I will run the code shown above. This will place the encrypted files in the same locations in the /quitelarge/upload/mega/ tree. These I will upload to mega.nz. I have also prepared code to create the necessary directory structure from scratch so I can delete the whole /update/ tree once I have completed the monthly backup and then recreate it from the script next month. A few more tweaks and enhancements and I will be ready to go.
Thanks again scasey! You have made my day.
p.s. A couple of comments about the sed command. A routine find and replace with sed is usually shown as something like
Code:
sed '/changethis/tothat/'
When changing paths which contain / characters - rather a pain. I found a thread over on stackoverflow which pointed out that the / / / in the sed command is an arbitrary delimiter. Using a ; or + or some other character works just as well and there is no need to try and escape the / characters in that paths. That was also a great tip.