Am 20.02.2013 23:40, schrieb Daniel Kahn Gillmor:
> On 02/20/2013 04:29 PM, Stefan Malte Schumacher wrote:
>> I want to create encrypted backups with tar and gpg, which I then want to
>> upload to my online storage. Strangely I can't get it working.
>> "find /mnt/raid/Dokumente/ -type f -print0 |tar cfzv | gpg --symmetric
>> --output 1.tar.gz.gpg"
> 
> if you want to pipeline like this, i don't think you want the "f" flag
> for tar.
> 

Correct.

> I also don't think you're using find and tar together properly -- i
> think you want xargs in the mix.
> 

> 0 dkg@alice:/tmp/cdtemp.cD3zXc$ find t -type f -print0 | xargs -0 tar
> czv | gpg --symmetric > foo.tgz.gpg
>

Better don't do that. If xargs receives too many arguments, it will call
tar multiple times. I don't think you can append tar files like that,
can you?

Better approach (in bash, at least):
tar --create --null --files-from=<(find ... -print0) | gpg ...

This also has the advantage that it works correctly if no matches are
found, i.e. it creates an empty archive instead of showing an error.

Alternatively use cpio which was explicitly built around the concept of
being used with find.

I would also get rid of the z option as gpg compresses, too.

Regards,
Florian Philipp


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to