Open mevans-pai opened 2 years ago
Thank you for reporting this issue. We will take a look. Please expect delay due to the holiday season.
Thanks.
Here are several of the patterns I've tried to use which seem to all behave in the same way, they either only match files that start with ., or g, or i, or t or don't match files that start with those characters:
--pattern "[!.git*]"
--pattern "!.git*"
--pattern '[!.git*]*'
--pattern '[!".git"*]*'
--pattern '[!^.git*]*'
--pattern '*[!git]*]*'
--pattern '[![.]git*]*'
--pattern '*[!git]*'
Reddit gave me some suggestions to try which exhibited the same behavior:
--pattern '^((?!\.git).)*$'
--pattern '[^((?!\.git).)*$]*'
The --pattern
only supports limited patterns just as we said in help:
> az storage blob upload-batch -h
Command
az storage blob upload-batch : Upload files from a local directory to a blob container.
Arguments
......
--pattern : The pattern used for globbing files or blobs in the
source. The supported patterns are '*', '?', '[seq]',
and '[!seq]'. For more information, please refer to
https://docs.python.org/3.7/library/fnmatch.html.
......
The [seq]
and [!seq]
is used like this way:
test_[0-9].*
to match test_0.txt
, test_1.py
or test_2.md
test_[!A-Z]*
to filter upper caseWhat you want is to match [!.]*
or .[!g]*
or .g[!i]*
or .gi[!t]*
, but unfortunately fnmatch
doesn't support OR
Can you try az storage copy
command? This commands support --exclude-pattern
which allows you to exclude files whose names match the pattern.
Hi, I actually don’t want OR. I want to exclude “.git*”.
I didn’t think to check the command help, as I was using this doc which is brief and links you to python docs for further info: https://docs.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest#az_storage_blob_upload_batch
I am new to Azure CLI so I’ll be sure to check the output of the command help in the future too.
I will see if ‘storage copy’ works when I am back at my desk tomorrow and then report back, thanks for the suggestion.
Describe the bug Using --pattern there doesn't seem to be a way to match dot files, like .github, .gitignore, etc? I don't want these pushed with my static website.
To Reproduce Try to run an 'az storage blob upload-batch' and ignore .gitignore with a --pattern ! match.
Expected behavior There should be some syntax to be able to ignore dot files, but creating a --exclude switch like the aws-cli would be easiest.
Environment summary azure/CLI@v1 on Github Actions