Reputation: 101
I am trying to automate a download from Azure using AzCopy(v8). In a blob we have few .zip files with prefix "BuildTools" and following with the time been modified. Currently what we do is hard-coded the /pattern to match the name of the file(newest modified time) in AzCopy command so we can download the latest version.
But I would like the script to automate sort all files with prefix "BuildTools" then only download the file with newest "Last Modified" time.
I have read the document from AzCopy(v8) and know there are flags(/MT, /XN, /XO) which related to "Modified Time" but they are not what I want.
Just wonder if anyone have any ideas on this. Thanks in advance.
Upvotes: 0
Views: 919
Reputation: 290
if you are open to try preview capabilities i would suggest to enable Blob Verisoning and download the latest. This way you manage the logic or lifecycle on the server side. less code on your end.
Preview Blog on Blob Versioning - https://learn.microsoft.com/en-us/azure/storage/blobs/versioning-overview?tabs=powershell (at the moment available in few regions but i guess worth waiting)
Otherwise you can try the file or object properties via the API call which has the last modified date in there. Link below: https://learn.microsoft.com/en-us/rest/api/storageservices/get-file-properties
Upvotes: 1