New submission from Gopesh Singh <gopeshsingh0...@gmail.com>:

I am trying to get Last modified dates of Folders and Files mounted on Azure 
Databricks.
I am using following Code:

```
root_dir = "/dbfs/mnt/ADLS1/LANDING/parent"

def get_directories(root_dir):

    for child in Path(root_dir).iterdir():

        if child.is_file():
            print(child, datetime.fromtimestamp(getmtime(child)).date())
      
        else:
            print(child, datetime.fromtimestamp(getmtime(child)).date())
            get_directories(child)
```
The issue is that it is giving wrong dates for some folders.
When I put a wait time of 1 second (time.sleep(.000005)) for each iteration, it 
gives correct results.
Otherwise, it sometimes give current date or date of folder listed from last 
iteration.

Seems, when the processing is fast, it is not able to pick correct modified 
date.

I have explained this issue on other portal: 
https://stackoverflow.com/questions/68917983/get-last-modified-date-of-folders-and-files-in-azure-databricks

----------
components: Library (Lib)
messages: 400312
nosy: gopeshsingh
priority: normal
severity: normal
status: open
title: Get last modified date of Folders and Files using pathlib module
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to