I have a script that runs hourly.
The output folder structure should be /todaysdate/hour/
So, at 00:00, the script will run & it should create both the todaysdate folder and a subfolder called 00.
At 01:00, the script will run - the todaysdate directory exists, so it should only create the subdirectory.
I've tried the below, but that doesn't work - how would I approach this?
file_path = 'Desktop/%s/%s' %(today_date, hour)
directory = os.path.dirname(file_path)
if not os.path.exists(directory):
os.makedirs(directory)