If you’d need to create a folder for current date in format as YYMMDDHH using python – You can use below code. This will create folder with “00” in hour if the time is between 00:00 to 12:00PM and from 12PM till 00:00AM, it will created folder with “12”.
For 2022-06-26 09:00:00 – It will create folder with name 2022062600.
For 2022-06-26 14:00:00 – It will create folder with name 2022062612.
#! usr/bin/python
from datetime import datetime
import os
today = datetime.now()
if today.hour < 12:
h = "00"
else:
h = "12"
os.mkdir("/home/xxx/" + today.strftime('%Y%m%d')+ h)