I have a couple of folders in a blob container that I want to download all of the contents of. I want to download the contents based off of the name of the folders alone, so like "testA" instead of "/data/testA/1" and "/data/test/2", etc.
This is the command I am trying:
azcopy cp "$https://mystorageaccount.blob.core.windows.net/mycontainer?sv=xxxx&ss=xxxx&srt=xxxx&sp=xxxx&se=xxxx&st=xxxx&spr=xxxx&sig=xxxx" /var/data/ --include-regex "*/testA/*"
However, when this command finishes running after a couple of minutes it has not found any files to download. Why isn't this regex matching files like:
/data/testA/2/file.txt /data/testA/2/file1.txt
I agree with Abdul Niyas P M's comment to escape the pattern's forward slashes with a
backslash ('\')
. This is because forward slashes in regular expressions have a specific meaning and must be escaped to match them literally.In my environment, I also faced the same situation, After modifying the regular expression pattern
".*\/sampleB\/.*"
matches all files that contain the string"/sampleB/"
in their path, regardless of their parent directories.Sample:
Response:
Reference:
azcopy copy | Microsoft Learn