gsutil

Recursively copy a child directory to the parent in Google Cloud Storage

Recursively copy a child directory to the parent in Google Cloud Storage Question: I need to recursively move the contents of a sub-folder to a parent folder in google cloud storage. This code works for moving a single file from sub-folder to the parent. client = storage.Client() bucket = client.get_bucket(BUCKET_NAME) source_path = Path(parent_dir, sub_folder, filename).as_posix() …

Total answers: 1

Google cloud get bucket – works with cli but not in python

Google cloud get bucket – works with cli but not in python Question: I was asked to preform integration with an external google storage bucket, I had received a credentials json, And while trying to do gsutil ls gs://bucket_name (after configuring myself with the creds json) I had received a valid response, as well as …

Total answers: 3

How to get list_blobs to behave like gsutil

How to get list_blobs to behave like gsutil Question: I would like to only get the first level of a fake folder structure on GCS. If I run e.g.: gsutil ls ‘gs://gcp-public-data-sentinel-2/tiles/’ I get a list like this: gs://gcp-public-data-sentinel-2/tiles/01/ gs://gcp-public-data-sentinel-2/tiles/02/ gs://gcp-public-data-sentinel-2/tiles/03/ gs://gcp-public-data-sentinel-2/tiles/04/ gs://gcp-public-data-sentinel-2/tiles/05/ gs://gcp-public-data-sentinel-2/tiles/06/ gs://gcp-public-data-sentinel-2/tiles/07/ gs://gcp-public-data-sentinel-2/tiles/08/ gs://gcp-public-data-sentinel-2/tiles/09/ gs://gcp-public-data-sentinel-2/tiles/10/ gs://gcp-public-data-sentinel-2/tiles/11/ gs://gcp-public-data-sentinel-2/tiles/12/ gs://gcp-public-data-sentinel-2/tiles/13/ gs://gcp-public-data-sentinel-2/tiles/14/ gs://gcp-public-data-sentinel-2/tiles/15/ . . …

Total answers: 3

How to run Google gsutil using Python

How to run Google gsutil using Python Question: After installing and configuring Google Cloud SDK gsutil command can be run by simply typing its name and the argument(-s) using Windows cmd. Here is the example: “C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkbingcloud” version But the same command fails if run using Python subprocess. With subprocess’s shell argument set …

Total answers: 2