Is there an AzCopy parameter to ensure the destination folder is empty?
If not, how should I check to ensure the folder is empty in a VSTS build pipeline?
What's your destination for the transfer, is it Blob or Local file?
If it's blob, use following script can check if the folder if empty
$ctx=New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $key
$blob = Get-AzureStorageBlob -Container $containerName -Prefix dir1/dir2/ -Context $ctx -MaxCount 1
if ($blob -eq $null)
{
# container/dir1/dir2/ Don't have blob, so do AzCopy transfer
}
If it's localfile, using following script:
$file = Get-ChildItem c:\dir1\dir2\
if ($file -eq $null)
{
# c:\dir1\dir2\ Don't have file, so do AzCopy transfer
}