I am using Django 2.0.4, Python 3.5 and an Azure FileStorage:
Everything is working fine with the Azure Python package. Now I want to list all files of one directory and see their LastModified
property and some other properties:
# getting Azure service
azureService = getAzureService()
# list all files in directory
archivesList = azureService.list_directories_and_files('myfilestoragename', directory_name='archives')
for element in archivesList:
element_name = element.name
element_lastmodified = element.properties.last_modified
element_contentlength = element.properties.content_length
The problem is: element_lastmodified
is always None
But element_contentlength
has a valid value.
When I am using MS Azure Storage Explorer and have a look into the properties
of each file, the property LastModified
has a valid timestamp.
Any ideas? Thanks!
last_modified is always None because unfortunately the service does not return this info when listing directories and files. Please refer to the REST doc here.
To get the last modified time of files/directories, please use get_directory_properties and get_file_properties.