I have a Jekyll blog with a directory structure that contains lots of hidden files and directories like .DS_Store
, .idea
and .git
. It also has intermediate build artifacts and scripts that begin with _
like _deploy.sh
and _drafts
.
I want to write a script that uploads everything to a bucket on Google Cloud Storage, except these hidden files and underscored artifacts.
I've tried using the -x
flag, but my expressions either exclude the whole current directory, and upload nothing, or fail to exclude some of the content that I want to exclude.
Here's what I have so far:
#!/bin/sh
gsutil -m rsync -rx '\..*|./[.].*$|_*' ./ gs://my-bucket.com/path
And the output I'm observing:
$ ./_deployblog.sh
Building synchronization state...
Starting synchronization