Reputation: 497
I am trying to use the command line on my local machine (anaconda prompt) to download a folder from a google cloud bucket. I am trying to do so using the gsutil
command.
I am first able to log in to the project using gcloud auth login
.
Doing so opens a browser, which I visit and login using the email for which I've been given permissions for the project, and then I run gcloud config set project PROJECT_ID
.
At this point I think I'm able to run gsutil cp -r gs://{bucket_name}/{folder_name} .
However, when I do so, the CLI simply pauses for a little bit, and then a new line appears. No error messages or any indication of anything going on is printed out, and no data is downloaded.
I'm very confused what the problem might be. In my previous attempts, I got messages saying that I did not have permissions, which I thought I had fixed by logging in using gcloud auth login
. But I cannot find any other documented instance on the web of the particular fail mode I'm in. I would be so grateful for any help!
Upvotes: 5
Views: 6379
Reputation: 171
I had the exact same issue on Windows (cmd) while running the suggested command that was auto-generated by GCP:
gsutil -m cp -r "gs://{bucket_name}/{folder_name}/" .
Turns out the problem was with the trailing /
(As suggested by @seeker_after_truth in a comment)
The following command worked:
gsutil -m cp -r "gs://{bucket_name}/{folder_name}" .
Upvotes: 9
Reputation: 94
You could consider the following sample commands and bullet points to achieve your task
Enter in to your project of choice and run the command :
gsutil -m cp “<source i.e., your bucket path followed by star.star>” <destination path i.e., your local machine location where you intend to download the folder>
For example:
gsutil -m cp "gs://my-bucket-name/*.*" D:\folder1\folder2
Upvotes: 2