- NAME
- gcloud-compute-copy-files - Copy files to and from Google Compute Engine virtual machines
- SYNOPSIS
-
gcloud compute copy-files [[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC …] [[USER@]INSTANCE:]DEST [--dry-run] [--format FORMAT] [--help] [--plain] [--project PROJECT] [--quiet, -q] [--ssh-key-file SSH_KEY_FILE] [--zone ZONE] [-h]
- DESCRIPTION
-
gcloud compute copy-filescopies files between a virtual machine instance and your local machine. -
To denote a remote file, prefix the file name with the virtual
machine instance’s name (e.g., “my-instance:
/my-file”). To denote a local file, do not add a prefix to the file name (e.g., “ /my-file”). For example, to copy a remote directory to your local host, run: -
$ gcloud compute copy-files \ my-instance:~/remote-dir \ ~/local-dir \ --zone us-central2-a -
In the above example, “
/remote-dir” from “my-instance” is copied into the “ /local-dir” directory. - Conversely, files from your local computer can be copied to a virtual machine:
-
$ gcloud compute copy-files \ ~/my-local-file-1 \ ~/my-local-file-2 \ my-instance:~/remote-destination \ --zone us-central2-a - If a file contains a colon (“:”), you must specify it by either using an absolute path or a path that begins with “./”.
-
Under the covers,
scp(1)is used to facilitate the transfer. - When the destination is local, all sources must be the same virtual machine instance. When the destination is remote, all source must be local.
- POSITIONAL ARGUMENTS
-
-
[[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC …] - Specifies a source file.
-
[[USER@]INSTANCE:]DEST - Specifies a destination for the source files.
-
- FLAGS
-
-
--dry-run - If provided, prints the command that would be run to standard out instead of executing it.
-
--formatFORMAT - Specify a format for printed output. By default, a command-specific human-friendly output format is used. Setting this flag to one of the available options will serialize the result of the command in the chosen format and print it to stdout. Supported formats are: "json", "text", "yaml".
-
--help - Display detailed help.
-
--plain -
Suppresses the automatic addition of
ssh(1)/scp(1)flags. This flag is useful if you want to take care of authentication yourself or re-enable strict host checking. -
--projectPROJECT - Google Cloud Platform project to use for this invocation.
-
--quiet - Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised.
-
--ssh-key-fileSSH_KEY_FILE - The path to the SSH key file. By deault, this is “~/.ssh/google_compute_engine”.
-
--zoneZONE - The zone of the instance to copy files to/from. If omitted, you will be prompted to select a zone.
-
-h - Print a summary help and exit.
-
gcloud compute copy-files
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License , and code samples are licensed under the Apache 2.0 License . For details, see our Site Policies .
Last updated August 11, 2014.