8

I want to copy files between a directory on my local computer disk and my Google Cloud Storage bucket with the below conditions:

1) Copy all new files and folders.

2) Skip all existing files and folders irrespective of whether they have been modified or not.

I have tried to implement this using the Google ACL policy, but it doesn't seem to be working.

I am using Google Cloud Storage admin service account to copy my files to the bucket.

1

1 Answer 1

14

As @A.Queue commented, the solution to skip existing files would be the use of the gsutil cp command with the -n option. This option means no-clobber, so that all files and directories already present in the Cloud Storage bucket will not be overwritten, and only new files and directories will be added to the bucket.

If you run the following command:

gsutil cp -n -r . gs://[YOUR_BUCKET]

You will copy all files and directories (including the whole directory tree with all files and subdirectories underneath) that are not present in the Cloud Storage bucket, while all of those which are already present will be skipped.

You can find more information related to this command in this link.

Not the answer you're looking for? Browse other questions tagged or ask your own question.