- Example on how to get creation time of file or folder in Python.
timeConvFromCTime = dt.datetime.strptime(time.ctime(), "%a %b %d %H:%M:%S %Y")
- Some example epoch to human discern able format conversion for time.
dt.datetime.strptime(time.ctime(), "%a %b %d %H:%M:%S %Y") # Format the current time time.ctime().
os.path.getctime(absolute_path) # To get the creation time of file or folder.
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch_time)) # Convert epoch time into specific format.
- So for converting the creation time of folder or file use
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch_time))
instead.
- Example of creating empty file using Python.
absPathToMD = os.path.join(absPathForFNew, realName + ".md")
with io.FileIO(absPathToMD, "w") as md: pass