Is it possible to pickup the latest file in my folder?
I currently type in the month to pickup the file of choice, However I am not sure how to pickup the latest modified file?
I am confused trying to use max
since the date I Input I use is used twice and want to use it to pickup latest smalldate
and then pickup the file in that folder.
( {smalldate}
for parent folder and {monthyear}
for a part of the file name)
monthyear = input("Enter Full Month and Year: ") #Ie August 2021
smalldate = pd.to_datetime(monthyear, format="%B %Y").strftime("%b %Y")
userid = str(os.getlogin())
gco = (rf"C:\Users\{userid}\OneDrive\Report\{smalldate}\Detail Report - {monthyear}.xlsx")