I have Storage Account in Azure which contains files inside the folders. I want to move the .txt and .csv files from one folder to other folder in same Storage Account Container using PowerShell script.
So, can anyone suggest me how to do that?
Add the complete steps with Swishonary's reply:
$context = New-AzureStorageContext -StorageAccountName {accountName} -StorageAccountKey {Enter your storage account key here}
$Blobs = Get-AzStorageBlob -Container "SourceContainer" -Blob SourceFolder/*.csv -Context $context
foreach ($blob in $Blobs) {
$blob.Name
# Copy to DestinationFolder
Start-AzStorageBlobCopy -SrcBlob "SourceFolder/SourceFile" -SrcContainer "<SourceContainer>" -DestContainer "<DestinationContainer>" -DestBlob "DestinationFolder/DestinationFile"
# Delete the source blob
Remove-AzStorageBlob -Container "SourceContainer" -Blob $blob.Name
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With