gcloud storage cp
[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
] [--recursive
, -R
, -r
] [--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 …
]
gcloud storage cp *.txt gs://my-bucket
The following command downloads all text files from a bucket to your current directory:
gcloud storage cp gs://my-bucket/*.txt .
The following command transfers all text files from a bucket to a different cloud storage provider:
gcloud storage cp gs://my-bucket/*.txt s3://my-bucket
Use the --recursive
option to copy an entire directory tree. The following command uploads the directory tree
:dir
gcloud storage cp --recursive dir gs://my-bucket
Recursive listings are similar to adding **
to a query, except **
matches only cloud objects and will not match prefixes. For example, the following would not match gs://my-bucket/dir/log.txt
gcloud storage cp gs://my-bucket/**/dir dir
**
retrieves a flat list of objects in a single API call. However, **
matches folders for non-cloud queries. For example, a folder
would be copied in the following.dir
gcloud storage cp ~/Downloads/**/dir gs://my-bucket
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
--recursive
, -R
, -r
--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 cp
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