I have, in one Storage Account, a container with folders and subfolders. In one of them, like container foo
and path fee/fii
, i have a large amount of files. I want to get the last modified date of every blob in my Notebook. I cannot solve this problem, I have searched but nothing likely appears. How could I achieve this?
Asked
Active
Viewed 643 times
0

Omar
- 1,029
- 2
- 13
- 33
1 Answers
1
Follow these steps:
Mount your storage account in azure synapse
mssparkutils.fs.mount(
"wasbs://<container_name>@<storage_account_name>.blob.core.windows.net/folder/",
"/<mount_name>/",
{"linkedService":"Linked_service_name"}
)
Sample code:
import os
from datetime import datetime
path = '/'
fpaths = [path+"/"+fd for fd in os.listdir(path)]
print(" file_path " + " create_date " + " modified_date ")
for fpath in fpaths:
statinfo = os.stat(fpath)
create_date = datetime.fromtimestamp(statinfo.st_ctime)
modified_date = datetime.fromtimestamp(statinfo.st_mtime)
print(fpath, create_date, modified_date)
Output:
For more details refer this Q&A by SaurabhSharma-msft

B. B. Naga Sai Vamsi
- 2,386
- 2
- 3
- 11
-
For me, this does not give me information about the files in the specific mounted path. Should the ```path``` really be ```/```? – Bart Feb 02 '23 at 08:48