Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get latest edited file from any directory

from os.path import expanduser
import os
home = expanduser("~")
latest_edited_folder = max([f for f in os.scandir(home)], key=lambda x: x.stat().st_mtime).name
search_on = home+''+latest_edited_folder
latest_edited_file = max([f for f in os.scandir(search_on)], key=lambda x: x.stat().st_mtime).name
Comment

PREVIOUS NEXT
Code Example
Python :: python file size in bytes 
Python :: delete directory if exists python 
Python :: date colomn to datetime 
Python :: get sum from x to y in python 
Python :: read excel file in python 
Python :: cant install tensorflow pip python 3.6 
Python :: check if dataframe contains infinity 
Python :: python adding digits 
Python :: strings are immutable in python 
Python :: create spark dataframe from pandas 
Python :: python get date from unix timestamp 
Python :: concatenate dataframes pandas without duplicates 
Python :: dense rank in pandas 
Python :: python function as parameter 
Python :: api testing with python 
Python :: where to find location of where python is installed linux 
Python :: create and use python classes 
Python :: flask flash not working 
Python :: python depth first search 
Python :: grid search cv 
Python :: solve sympy 
Python :: python convert string to float array 
Python :: clamp number in python 
Python :: check if path exists python 
Python :: templateDoesNotExist Django 
Python :: python replace character in string 
Python :: dataframe move row up one 
Python :: delete an element by value from a list if it made of white spaces python 
Python :: Current date and time or Python Datetime today 
Python :: get mode dataframe 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =