Skip to content

the suggestions to implement of a "-z <file extensions>" and a "-Z" flags #3205

Open

Description

@hobayoba

What is your current rclone version (output from rclone version)?

rclone v1.47.0

  • os/arch: linux/amd64
  • go version: go1.12.4

What problem are you are trying to solve?

I trying to compress all files or some files filtered by their extensions during uploading it to gcs, s3, and other providers buckets which allow us to set the metadata 'Content-Encoding: gzip' for compressed files

How do you think rclone should be changed to solve that?

it would be great to implement a -z <file extensions> and -Z flags to solve managing of compressed files and allowing to set 'Content-Encoding: gzip' for such uploaded files on remote

that implemented in gsutil as flags -Z and -z and well documented here.

related info:

Activity

  1. added this to the Soon milestone on May 19, 2019
  2. larinam commented on Sep 19, 2019

    @larinam

    Could you speed up the implementation, please?

  3. ncw commented on Sep 19, 2019

    @ncw
    Member

    Would anyone like to help with this?

    I think it probably applies to all the bucket based remotes.

  4. pataquets commented on Sep 23, 2019

    @pataquets
    Contributor

    In case anybody wants to pick it up, just linking to #59, where there is an explanation for how to implement a generic "add headers" feature. Not sure if this would be much different, though.

  5. pgalbavy commented on Jun 26, 2020

    @pgalbavy

    As per https://forum.rclone.org/t/gzip-for-google-cloud-storage/17430 I've started thinking about this, but my Golang is only at starter level and my knowledge of rclone code layout is minimal.

  6. pataquets commented on Nov 4, 2020

    @pataquets
    Contributor

    @pol1000000 I've checked and the issue/feature is not solved.
    Would you mind reopening to allow others to pick it up? If you're no longer interested, you can unsubscribe from notifications.
    Thank you.

  7. acme commented on Apr 8, 2026

    @acme
    Contributor

    gsutil is deprecated. The modern equivalent is gcloud storage cp: https://docs.cloud.google.com/sdk/gcloud/reference/storage/cp

    --gzip-local=[FILE_EXTENSIONS,…], -z [FILE_EXTENSIONS,…]

    Applies gzip content encoding to any file upload whose extension matches the input extension list. This is useful when uploading files with compressible content such as .js, .css, or .html files. This saves network bandwidth and space in Cloud Storage.

    When you specify the --gzip-local option, the data from files is compressed before it is uploaded, but the original files are left uncompressed on the local disk. The uploaded objects retain the Content-Type and name of the original files. However, the Content-Encoding metadata is set to gzip and the Cache-Control metadata set to no-transform. The data remains compressed on Cloud Storage servers and will not be decompressed on download by gcloud storage because of the no-transform field.

    Since the local gzip option compresses data prior to upload, it is not subject to the same compression buffer bottleneck of the in-flight gzip option.

    --gzip-local-all, -Z

    Applies gzip content encoding to file uploads. This option works like the --gzip-local option described above, but it applies to all uploaded files, regardless of extension.

    CAUTION: If some of the source files don't compress well, such as binary data, using this option may result in files taking up more space in the cloud than they would if left uncompressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions