Professional Cloud Developer · Free Practice Question Medium

Question 27

Copy the directory "local-scripts" and its entire contents from your local workstation to a virtual machine instance on Compute Engine.


What command would be appropriate to use?

  • A gsutil cp --project 'my-gcp-project' -R ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone 'us-east1-b'
  • B gcloud compute mv --project 'my-gcp-project' --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone 'us-east1-b'
  • C gcloud compute scp --project 'my-gcp-project' --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone 'us-east1-b'
Reveal correct answer

Correct answer: C

Explanation

To copy a directory and its contents from a local workstation to a Compute Engine virtual machine instance, the gcloud compute scp command should be used with the --recurse flag. This command allows for the recursive copying of directories and their contents. The command should include the project name, virtual machine instance name, and the zone. The source directory should be specified with its path on the local workstation, and the destination directory should be specified with its path on the virtual machine instance. The --recurse flag indicates that the directory and all of its contents should be copied. This command is useful for moving files and directories between local workstations and virtual machine instances in the Google Cloud Platform.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need