Score:0

How can I compress files while uploading them to GCP?

ch flag

I am trying to automate backups to a remote GCP bucket. I am using the gsutil CLI and Crontab to schedule transfers of all files in a given directory. I would like to compress the files as they are being transferred, and was led to believe that the following command would work:

gsutil -m cp -r -z * [local_path] gs://[GCP Path]

This however is not looking to be the case and it seems that individual files are being copied, can someone provide me with the exact command followed by a direct link to GCP documentation where this noted?

Thanks!

Score:0
cn flag

Depending on the file extensions, you might need to change the lowercase z to uppercase Z in your command.

The -z (lowercase z) option applies gzip content-encoding to any file upload whose extension matches the -z extension list. This is useful when uploading files with compressible content such as .js, .css, or .html files.

The -Z (capital Z) option applies gzip content-encoding to file uploads. This option works like the -z option described above, but it applies to all uploaded files, regardless of extension.

chargingBrontosaurus avatar
ch flag
I ran ```gsutil -m cp -r -Z * [local_path] gs://[GCP Path]``` and this did not compress any of my files.
John Hanley avatar
cn flag
@chargingBrontosaurus - are the files compressible? some file types are not compressible, some are already compressed. Edit your question with more details. Test with a single file.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.