Reputation: 2539
I have the following command to tar a folder while sending it to aws s3:
tar czf - /path/to/folder | aws s3 cp s3://bucket.file.tar.gz
I would like to add output from mysqldump to the folder, but without saving the file - even temporarily - in the folder structure.
Ideally I also don't want to save the output of tar temporarily somewhere else, both for general security concerns and to save disk space.
Upvotes: 2
Views: 458
Reputation: 818
You can change the path of a file being added to a tar file like so:
tar -czf - --transform=s,Downloads,var/lib, Downloads/myfile.txt > out.gz
tar -tzf out.tgz
var/lib/myfile.txt
Upvotes: 1