gcloud storage mv [SOURCE …] DESTINATION [--additional-headers=HEADER=VALUE] [--all-versions, -A] [--no-clobber, -n] [--content-md5=MD5_DIGEST] [--continue-on-error, -c] [--daisy-chain, -D] [--do-not-decompress] [--include-managed-folders] [--manifest-path=MANIFEST_PATH, -L MANIFEST_PATH] [--preserve-posix, -P] [--print-created-message, -v] [--read-paths-from-stdin, -I] [--skip-unsupported, -U] [--storage-class=STORAGE_CLASS, -s STORAGE_CLASS] [--canned-acl=PREDEFINED_ACL, --predefined-acl=PREDEFINED_ACL, -a PREDEFINED_ACL --[no-]preserve-acl, -p] [--gzip-in-flight=[FILE_EXTENSIONS,…], -j [FILE_EXTENSIONS,…] | --gzip-in-flight-all, -J | --gzip-local=[FILE_EXTENSIONS,…], -z [FILE_EXTENSIONS,…] | --gzip-local-all, -Z] [--ignore-symlinks | --preserve-symlinks] [--decryption-keys=[DECRYPTION_KEY,…] --encryption-key=ENCRYPTION_KEY] [--cache-control=CACHE_CONTROL --content-disposition=CONTENT_DISPOSITION --content-encoding=CONTENT_ENCODING --content-language=CONTENT_LANGUAGE --content-type=CONTENT_TYPE --custom-time=CUSTOM_TIME --clear-custom-contexts | --custom-contexts=[CUSTOM_CONTEXTS_KEYS_AND_VALUES,…] | --custom-contexts-file=CUSTOM_CONTEXTS_FILE | --remove-custom-contexts=[CUSTOM_CONTEXTS_KEYS,…] --update-custom-contexts=[CUSTOM_CONTEXTS_KEYS_AND_VALUES,…] --clear-custom-metadata | --custom-metadata=[CUSTOM_METADATA_KEYS_AND_VALUES,…] | --remove-custom-metadata=[METADATA_KEYS,…] --update-custom-metadata=[CUSTOM_METADATA_KEYS_AND_VALUES,…]] [--if-generation-match=GENERATION --if-metageneration-match=METAGENERATION] [--retain-until=DATETIME --retention-mode=RETENTION_MODE] [GCLOUD_WIDE_FLAG …]
Renaming Groups Of Objects
You can use the mv command to rename all objects with a given prefix to have a new prefix. For example, the following command renames all objects under gs://my_bucket/oldprefix to be under gs://my_bucket/newprefix, otherwise preserving the naming structure:
gcloud storage mv gs://my_bucket/oldprefix gs://my_bucket/newprefixNote that when using mv to rename groups of objects with a common prefix, you cannot specify the source URL using wildcards; you must spell out the complete name.
If you do a rename as specified above and you want to preserve ACLs.
Non-Atomic Operation
Unlike the case with many file systems, the mv command does not perform a single atomic operation. Rather, it performs a copy from source to destination followed by removing the source for each object.
A consequence of this is that, in addition to normal network and operation charges, if you move a Nearline Storage, Coldline Storage, or Archive Storage object, deletion and data retrieval charges apply. See the documentation for pricing details.gcloud storage mv gs://my_bucket/* dirSimilarly, to move all objects from a local directory to a bucket you could use:
gcloud storage mv ./dir gs://my_bucketThe following command renames all objects under gs://my_bucket/oldprefix to be under gs://my_bucket/newprefix, otherwise preserving the naming structure:
gcloud storage mv gs://my_bucket/oldprefix gs://my_bucket/newprefixThe following command would clear all custom contexts from the destination object while moving the object to the destination bucket.
gcloud storage mv gs://my-bucket/object gs://destination-bucket/object --clear-custom-contextsSOURCE …]DESTINATION--additional-headers=HEADER=VALUEheader1=value1,header2=value2. Overrides
the default storage/additional_headers property value for this
command invocation.
--all-versions, -A--no-clobber, -n--content-md5=MD5_DIGEST--continue-on-error, -c--daisy-chain, -D--do-not-decompress--include-managed-folders--manifest-path=MANIFEST_PATH, -L MANIFEST_PATHIf the manifest file already exists, gcloud storage appends log items to the existing file.
Objects that are marked as "OK" or "skipped" in the existing manifest file are not retried by future commands. Objects marked as "error" are retried.--preserve-posix, -PFor uploads, these attributes are read off of local files and stored in the cloud as custom metadata. For downloads, custom cloud metadata is set as POSIX attributes on files after they are downloaded.
On Windows, this flag will only set and restore access time and modification time because Windows doesn't have a notion of POSIX UID, GID, and mode.--print-created-message, -v--read-paths-from-stdin, -I--skip-unsupported, -U--storage-class=STORAGE_CLASS, -s STORAGE_CLASS--canned-acl=PREDEFINED_ACL, --predefined-acl=PREDEFINED_ACL, -a PREDEFINED_ACL--[no-]preserve-acl, -p--preserve-acl to enable and
--no-preserve-acl to disable.
--gzip-in-flight=[FILE_EXTENSIONS,…], -j [FILE_EXTENSIONS,…]--gzip-in-flight option, files being uploaded
are compressed in-memory and on-the-wire only. Both the local files and Cloud
Storage objects remain uncompressed. The uploaded objects retain the
Content-Type and name of the original files.
--gzip-in-flight-all, -J--gzip-in-flight 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 longer uploads.
--gzip-local=[FILE_EXTENSIONS,…], -z [FILE_EXTENSIONS,…]
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.
--gzip-local-all, -Z--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.
Flags to influence behavior when handling symlinks. Only one value may be set.
At most one of these can be specified:
--ignore-symlinks--preserve-symlinksDirectory symlinks are only followed if this flag is specified.
CAUTION: No validation is applied to the symlink target paths. Once downloaded, preserved symlinks will point to whatever path was specified by the placeholder, regardless of the location or permissions of the path, or whether it actually exists.
This feature is not supported on Windows.--decryption-keys=[DECRYPTION_KEY,…]--encryption-key=ENCRYPTION_KEYprojects/{project}/locations/{location}/keyRings/{key-ring}/cryptoKeys/{crypto-key}.
The specified key also acts as a decryption key, which is useful when copying or
moving encrypted data to a new location. Using this flag in an objects
update command triggers a rewrite of target objects.
--cache-control=CACHE_CONTROL--content-disposition=CONTENT_DISPOSITION--content-encoding=CONTENT_ENCODINGgzip).
--content-language=CONTENT_LANGUAGEen signifies
"English").
--content-type=CONTENT_TYPEtext/html).
--custom-time=CUSTOM_TIME--clear-custom-contexts--custom-contexts=[CUSTOM_CONTEXTS_KEYS_AND_VALUES,…]--custom-contexts-file=CUSTOM_CONTEXTS_FILE1. The following JSON document shows two key value pairs, i.e. (key1, value1) and (key2, value2):
{ "key1": {"value": "value1"}, "key2": {"value": "value2"} }
2. The following YAML document shows two key value pairs, i.e. (key1, value1) and (key2, value2):
key1: value: value1 key2: value: value2
--clear-custom-contexts, --custom-contexts or
--custom-contexts-file. If --update-custom-contexts
and --remove-custom-contexts are specified together, the
--remove-custom-contexts would be applied first on object.
--remove-custom-contexts=[CUSTOM_CONTEXTS_KEYS,…]--update-custom-contexts=[CUSTOM_CONTEXTS_KEYS_AND_VALUES,…]--clear-custom-metadata--preserve-posix, POSIX attributes will still be stored in custom
metadata.
--custom-metadata=[CUSTOM_METADATA_KEYS_AND_VALUES,…]--preserve-posix,
POSIX attributes are also stored in custom metadata.
--custom-metadata or --clear-custom-metadata, but can
be specified together:
--remove-custom-metadata=[METADATA_KEYS,…]--update-custom-metadata. When used with
--preserve-posix, POSIX attributes specified by this flag are not
preserved.
--update-custom-metadata=[CUSTOM_METADATA_KEYS_AND_VALUES,…]--remove-custom-metadata. When keys overlap with those
provided by --preserve-posix, values specified by this flag are
used.
--if-generation-match=GENERATION--if-metageneration-match=METAGENERATION--retain-until=DATETIME--retention-mode=RETENTION_MODERETENTION_MODE must be one of: Locked,
Unlocked.
--access-token-file,
--account, --billing-project,
--configuration,
--flags-file,
--flatten, --format, --help, --impersonate-service-account,
--log-http,
--project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run $ gcloud help for details.
gcloud alpha storage mv
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.