3

So I recently signed up for Google Cloud unaware it was more for coding than typical online storage. So I backed up one of my flash drives before wiping it and now I cant retrieve the files to replace them on the flash drive. I've tried a few commands I've seen on other questions here but only receiving results of:

C:\Users\Johnny\AppData\Local\Google\Cloud SDK>gsutil -m cp -r dir gs://backup85468523
CommandException: No URLs matched: dir
CommandException: 1 file/object could not be transferred.

or

C:\Users\Johnny\AppData\Local\Google\Cloud SDK>gsutil -m cp -R    gs://backup85468523
CommandException: Wrong number of arguments for "cp" command.
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • Does this answer your question? [Downloading folders from Google Cloud Storage Bucket](https://stackoverflow.com/questions/44406729/downloading-folders-from-google-cloud-storage-bucket) – Venryx Jan 02 '20 at 17:59
  • For those wanting to avoid installing local tools like `gsutil`, there is a way to **download files *and* folders** from Google Cloud Storage entirely in the browser: https://stackoverflow.com/a/59567734/2441655 – Venryx Jan 02 '20 at 17:56

3 Answers3

1

The command should be in the form gsutil cp [OPTION]... src_url dst_url, with both source and destination directories, as detailed on the cp - Copy files and objects documentation page. Your command seems to lack the destination part. If you mean the local directory, you can indicate is with a dot "." .

George
  • 1,488
  • 1
  • 10
  • 13
1

I don't know why this works, since it differs from the docs, but just removing dir worked fine:

gsutil -m cp -r gs://backup85468523
tir38
  • 9,810
  • 10
  • 64
  • 107
  • Missing local directory argument at the end. Or just a "." for current directory. `gsutil -m cp -r gs://backup85468523 .` – Zain Qasmi Sep 28 '21 at 21:43
-1

Use the below code to download a folder from google cloud storage to local folder

os.system('gsutil -m cp -R gcs-folder-path local-folder-path')

aksdev
  • 69
  • 1
  • 6