簡體   English   中英

Azure CLI - az 存儲 blob 刪除批處理模式

[英]Azure CLI - az storage blob delete-batch pattern

我的存儲帳戶storageaccount1中有一個名為container1的容器,其中包含以下文件:

blobs/tt-aa-rr/data/0/2016/01/03/02/01/20.txt  
blobs/tt-aa-rr/data/0/2016/01/03/02/02/12.txt  
blobs/tt-aa-rr/data/0/2016/01/03/02/03/13.txt  

blobs/tt-aa-rr/data/0/2016/01/03/03/01/10.txt

我想刪除前 3 個,為此我使用以下命令:

az storage blob delete-batch --source container1 --account-key XXX --account-name storageaccount1 --pattern 'blobs/tt-aa-rr/data/0/2016/01/03/02/*' --debug

文件沒有被刪除,我看到以下日志:

urllib3.connectionpool : Starting new HTTPS connection (1): storageaccount1.blob.core.windows.net:443
urllib3.connectionpool : https://storageaccount1.blob.core.windows.net:443 "GET /container1?restype=container&comp=list HTTP/1.1" 200 None

我的模式有什么問題?

如果我嘗試逐個文件地刪除文件,它會起作用。

如評論中所述,您無法將模式應用於子文件夾,只能應用於第一級文件夾,如此處所述 但是,如果需要,您可以輕松編寫腳本來列出容器中的 blob,使用前綴過濾它們az storage blob list ,然后對每個結果az storage blob list應用刪除。

這是對我有用的方法——應用於上面列出的命令。

az storage blob delete-batch --source container1 --account-key XXX --account-name storageaccount1 --pattern blobs/tt-aa-rr/data/0/2016/01/03/02/\* --debug

我沒有引用pattern參數,我在*之前添加了一個轉義符。 在 Mac 上使用 iTerm2。 我沒有嘗試--debug--dryrun參數確實有助於讓它告訴我它匹配(或不匹配)的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM