2015-09-24 32 views
0

我一直在爲每個容器運行此腳本,刪除了超過35天的我的SQL備份。任何人都可以幫助我編寫一個循環(foreach),通過每個容器移除超過35天的文件嗎?Azure Powershell:刪除多個容器中的文件

這是我的一個容器的腳本,但我需要運行這個每個容器。

$SubScriptionName = "subname" 
$StorageAccountName = "storagename" 
Select-AzureSubscription –SubscriptionName $SubScriptionName 
Set-AzureSubscription –SubscriptionName $SubScriptionName –CurrentStorageAccount $StorageAccountName 

$Container = "nameOfContainer" 
$CleanupOlderThan35Days = [DateTime]::UtcNow.AddDays(-35) 

Get-AzureStorageBlob -Container $Container | Where-Object { $_.LastModified.UtcDateTime -lt $CleanupOlderThan35Days } |Remove-AzureStorageBlob 

回答

相關問題