MagicHat
MagicHat

Reputation: 429

Copy folders from VM gcp to local machine

I see some question here but no work fo me, i think is a sintaxe error:

In my instance :

ss@si:~/public_html/msite.com$

I have some folders:

folder1 folder2 folder3 

I need copy all folders to my local machine so i try, run the comand in my local machine.

$gcloud init

After i answer some question i go to prompt again, amd try run:

gcloud compute scp --recurse ss@si:~/public_html/msite.com/* magicnt@debian:/var/www/html/local-folder/ --zone southamerica-east1-a --project xxxxxxxxxxxxxxxx

And get error:

ERROR: (gcloud.compute.scp) All sources must be local files when destination is remote.

So my doubts are:

To copy from vm to local machine i need run the command in vm or local machine?

Upvotes: 1

Views: 1638

Answers (1)

Oleksandr Bushkovskyi
Oleksandr Bushkovskyi

Reputation: 825

I believe you need to specify destination without machine name, just a path to local folder. Not a

magicnt@debian:/var/www/html/local-folder/

but

/var/www/html/local-folder/

Then your complete command should be:

gcloud compute scp --recurse ss@si:~/public_html/msite.com/* /var/www/html/local-folder/ --zone southamerica-east1-a --project xxxxxxxxxxxxxxxx

See "gcloud compute scp" help example:

To copy a remote directory, ~/narnia, from example-instance to the ~/wardrobe directory of your local host, run:

    $ gcloud compute scp --recurse example-instance:~/narnia ~/wardrobe

Upvotes: 2

Related Questions