Reputation: 2254
I'm trying to use azcopy to list files in a blob container. I can only get it to tell me how many files exist but not actually return the names of the files. the command i'm using is:
azcopy /source:$sharedimagesource /dest:$dest /sourcekey:$srckey /S /V /L
The output is:
Listed: 2 file(s)
[2016/05/03 12:22:09] Transfer summary:
-----------------
Total files listed: 2
Elapsed time: 00.00:00:00
Any way to get the names of the files?
Upvotes: 1
Views: 17593
Reputation: 75
version 10 azcopy.exe list --machine-readable --mega-units --running-tally >>C:\TEMP\azycopyLogs\outFile_Blob_List.txt
Upvotes: 0
Reputation: 21
Azcopy now has a list option
azcopy.exe list 'https://storageaccount.blob.core.windows.net/container<SAStoken>'
Upvotes: 1
Reputation: 531
You can use powershell to do this:
$SourceStorageAccount = "yourstorageaccount"
$SourceStorageKey = "yourKey"
$SourceStorageContainer = 'yourcontainerName'
$SourceStorageContext = New-AzureStorageContext –StorageAccountName $SourceStorageAccount -StorageAccountKey $SourceStorageKey
$Blobs = Get-AzureStorageBlob -Context $SourceStorageContext -Container $SourceStorageContainer
foreach ($Blob in $Blobs)
{
Write-Output "$Blob.Name"
}
Upvotes: 1
Reputation: 1579
Indeed, the blob names are not listed in the command line. But instead, you can specify an output file and then the copied blobs will be listed in that file. Just modifed your command as below:
azcopy /source:$sharedimagesource /dest:$dest /sourcekey:$srckey /S /L /V:C:\test\output.txt
Just specify the output path after /V parameter. I just tested and it works. Hope this helps.
Upvotes: 2