andrew-kelleher / azurecontainerregistry-cleanup

script to delete surplus images from Azure Container Registry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should use $RepositoryTags.count instead of $RepositoryTags.length

ryangrey opened this issue · comments

write-host "# Total images:"$RepositoryTags.length" # Images to keep:"$ImagestoKeep

for ($item=$ImagestoKeep; $item -lt $RepositoryTags.length; $item++) {

$RepositoryTags = az acr repository show-tags --name XXXXX --repository prod/rabbitmq --output tsv --orderby time_desc
echo $RepositoryTags      
3.7-management-alpine
echo $RepositoryTags.count                                                                                             
1
echo $RepositoryTags.Length                                                                                            
21

I also agree with this change. There are several areas that refer to .length instead of .count. Thank you for putting this together - saved me some time!

Thanks for this, it saved me time too!