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-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/newprefix
Note 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/* dir
Similarly, to move all objects from a local directory to a bucket you could use:
gcloud storage mv ./dir gs://my_bucket
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/newprefix
SOURCE
…]
DESTINATION
header1=value1,header2=value2
. Overrides the default storage/additional_headers
property value for this command invocation.
--all-versions
, -A
Note: This option is only useful when the destination bucket has Object Versioning enabled. Additionally, the generation numbers of copied versions do not necessarily match the order of the original generation numbers.
--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
If 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
, -P
For 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
,…]
When you specify the --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.
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
--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.
At most one of these can be specified:
--ignore-symlinks
--preserve-symlinks
Directory 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_KEY
projects/{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_ENCODING
gzip
).
--content-language
=CONTENT_LANGUAGE
en
signifies "English").
--content-type
=CONTENT_TYPE
text/html
).
--custom-time
=CUSTOM_TIME
--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_MODE
RETENTION_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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5