gsutil rsync has an "exclude" option (-x), but no "include" option. Is there some way to include a selected file without rsyncing the entire directory? Excluding all but the desired file will not work because random files will be saved to that directory.
https://cloud.google.com/storage/docs/gsutil/commands/rsync
If you know the name of a single file you want to sync you don't even need to perform an ls
like Balajee suggests. Just specify that base file name in the reverse regex:
gsutil rsync -x '(?!^myfile\.txt$)' ./directory-with-desired-file gs://my-bucket
Example here: https://github.com/GoogleCloudPlatform/gsutil/issues/532#issuecomment-394039557
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With