Google Cloud Storage - GSUtil - Copy files, skip existing, do not overwrite

ECII picture ECII · Jul 21, 2012 · Viewed 11.5k times · Source

I want to sync a local directory to a bucket in Google Cloud Storage. I want to copy the local files that do not exist remotely, skipping files that already exist both remote and local. Is this possible to do this with GSUtil? I cant seem to find a "sync" option for GSUtil or a "do not overwrite". Is it possible to script this?

I am on Linux (Ubuntu 12.04)?

Answer

rein picture rein · Dec 16, 2012

gsutil now supports the noclobber flag (-n) on the cp command. Update your gsutil to the latest version (using gsutil update) and then use the -n flag when performing a copy.

This flag will skip files that already exist at the destination.