Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving files between folders in Google Cloud Storage with Google Cloud Console

I have uploaded several files into the same folder on Google Cloud Storage using the Google Cloud Console. I would now like to move several of the files to a newly created folder in Google Cloud Storage and I cannot see how to do that via the Google Cloud Console. I found instructions to move the files via command prompt instructions on gsutil. However, I am not comfortable with command line interfaces and have not been able to get gsutil to work on my machine.

Is there a way to move files in Google Cloud Storage from one folder to another via the Google Cloud Console?

like image 695
Kelly Avatar asked Aug 19 '14 21:08

Kelly


People also ask

Which command would you use to move objects between two Cloud Storage buckets?

To copy any single object from one GCS location to another, you can use the copy command. This can be done from either of our public APIs, or by using the command-line client, gsutil.

How do I move a folder in GCP?

Click on the options menu (the vertical ellipsis) in the row and click Move. Click Browse to select the folder to which you want to move the project. Click Move.


1 Answers

Update: Google Cloud Shell provides a terminal within the Google Cloud Console site without having to manually create VMs; it comes with gsutil and Google Cloud SDK pre-installed and pre-authenticated.


Prior answer: If you're having issues installing gsutil on your computer, consider the following approach:

  1. Spin up an f1-micro instance with the Google-provided Debian image which will have gsutil preinstalled.

  2. Use the SSH button to connect to it using the browser interface (you can also use gcutil or gcloud commands, if you have those installed and available).

  3. Run gcloud auth login --no-launch-browser within the instance. It will give you a URL to open with your browser. Once you open it, grant the OAuth permissions, and it will display a code. Paste that code back into the command-line window where you ran the command so that it gets the authentication token.

  4. Run the gsutil mv command, as suggested by Travis Hobrla:

    gsutil mv gs://bucket/source-object gs://bucket/dest-object

  5. Once you're done with gsutil, delete the instance by clicking on the Delete button at the top of the VM instance detail page. Make sure that the box marked "Delete boot disk when instance is deleted" on the same VM instance page is checked, so that you don't leave an orphaned disk around, which you will be charged for.

    You can also browse your persistent disks on the "Disks" tab right below the "VM instances" tab, and delete disks manually there, or make sure there aren't an orphaned disks in the future.

Given the current price of $0.013/hr for an f1-micro instance, this should cost you less than a penny to do this, as you'll only be charged while the instance exists.

like image 100
Misha Brukman Avatar answered Sep 30 '22 17:09

Misha Brukman