Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include file in gsutil rsync?

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

like image 332
wolfv Avatar asked Dec 05 '15 21:12

wolfv


1 Answers

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

like image 167
Code Commander Avatar answered Sep 21 '22 18:09

Code Commander