Reputation: 43
Previously gsutil appeared to not upload hidden files. Now hidden files cannot be prevented from upload. Using the -x command with either
.*/\\..*
or
.*/[.].*
still uploads both hidden files and directories.
This is with a local directory up to a bucket.
Is there a different expression that is required?
Upvotes: 4
Views: 1515
Reputation: 208
As the regexp is not tied to the edges of the string, .*
's at the beginning and at the end are not necessary, plus we can use grouping to simplify (sic!) a bit:
gsutil rsync -x '(^|/)\.' source dest
Where \.
is the dot itself and (^|/)
states that the dot should follow either the beginning of file name (^
) or a /
- a dot file in a subfolder.
Upvotes: 0
Reputation: 4903
This works for both hidden files and directories, at any spot in the path:
gsutil rsync -x '.*/\..*|^\..*' source dest
The other answer didn't work for me.
Upvotes: 1
Reputation: 12145
The -x
exclude option should work:
gsutil rsync -x '\..*|./[.].*$' source-dir gs://your-bucket
You can learn more about it from the [official documentation].
Upvotes: 2