pydit.wrangling.file_utils.get_latest_modif_file_from_dir¶
- pydit.wrangling.file_utils.get_latest_modif_file_from_dir(folder_path, pattern='*')[source]¶
Returns the latest file from a folder, based on last modified date
Uses Pathlib to search recursively and to get the last modified date using the stat() method
- Parameters:
folder_path (str) – The folder path to search
pattern (str, optional) – The pattern to search for, by default “*”
- Returns:
latest_file (pathlib.Path) – The latest file found
latest_file_md (datetime.datetime) – The last modified date of the latest file as a bonus