How to compress files with xz and upload archive to Google cloud ?
ยท
99 words
ยท
1 minute read
First, install Google cloud command line tool and configure it.
pip install gsutil
- Have your project id ready using
gsutil config
. Check docs for more info.
Create the archive / compressed file
tar --create --verbose --xz --file images.tar.xz /directory/containing/images/*
Upload the archive/compressed file to Google cloud
gsutil cp images.tar.xz gs://<bucket name>
. replace<bucket name>
with your Google cloud bucket name ๐.
If you want to extract contents (images in this case) from archive, use this command tar -xf file.tar.xz
.
xz is supposed to be the “best” general purpose compression algorithm in terms of compression ratio, but it’s also slow.