Use Google Cloud Functions to copy an entire Bucket sub directory into the root of another bucket on finalize event within the source sub directory

Hector Simms
Hector Simms used Ask the Experts™
on
Hi,

New to GCP and would like some help and clear instruction on how to do the following:

I would like to copy an entire buckets sub directory (say bucket-1/folder-1/folder-a) when a file is uploaded into this sub directory only. Not the whole bucket.

The entire sub directory should be copied to the root of bucket-2 skipping any existing files/folders.

I've successfully run a few functions that copy single files etc. to get my bearings but struggling to work out how to do more indepth stuff like copying the entire directory tree and skipping existing files and folders. As well as it being event driven in just the source directory NOT the entire bucket. Unfortunately the Cloud Functions UI doesn't allow you to select a sub directory for the trigger event, only the Bucket.

Thanks in advance.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial