Access upload date of files in azure file share with a python runbook
Ana Sofia Moreira
21
Reputation points
Good morning,
I want to acess the most recent files of an azure file share with a python runbook and with my code I a doubts.
1- when I list the files in the file share with this code:
from azure.storage.file import FileService
file_service = FileService(account_name='', account_key='')
generator = list(file_service.list_directories_and_files(''))
try:
for file_or_dir in generator:
order_file_upload={}
file_in = file_service.get_file_properties(share_name='', directory_name="", file_name=file_or_dir.name)
file_date= file_in.properties.last_modified
order_file_upload[str(file_date.date())]=file_or_dir.name
except ResourceNotFoundError as ex:
print('ResourceNotFoundError:', ex.message)
I have this error:
Failed
Traceback (most recent call last): File "", line 17, in <module> except ResourceNotFoundError as ex:NameError: name 'ResourceNotFoundError' is not defined