0

I want to list the only the last week data inside the azure container. The python code I'm using first lists whole data and then filters it according to given the if condition.

list1 = [a.name for a in container_client.list_blobs(name_starts_with='folder1/') if a.last_modified.date() in last_week]

The time taken by this command increases as the size of folder1 increases, So is their any way to get this list in an more efficient manner ?

Srijit_Bose-MSFT
  • 1,010
  • 4
  • 13
Kazama
  • 61
  • 9
  • 1
    Have you seen this question ? https://stackoverflow.com/questions/44777851/is-it-possible-to-list-azure-blobs-where-last-modified-date-some-date – Anupam Chand Sep 14 '21 at 07:35
  • I need pythonic solution, the solution given their is command line. – Kazama Sep 14 '21 at 07:47
  • 1
    I was referring to the answer that says that this cannot be done by the SDK(.NET or Python) or Rest API but it can only be done by PowerShell as of now. The answer also gives an alternative of prefixing the filenames with the date so you can query them using the "name_starts_with" parameter. – Anupam Chand Sep 14 '21 at 07:53

0 Answers0