Skip to content

Instantly share code, notes, and snippets.

@petfactory
Created April 6, 2015 13:37
Show Gist options
  • Save petfactory/40dec19adc5710857ece to your computer and use it in GitHub Desktop.
Save petfactory/40dec19adc5710857ece to your computer and use it in GitHub Desktop.
Create a dir from datetime
import datetime
import os
time_string = datetime.datetime.now().strftime("%Y-%m-%d %H.%M.%S")
#print(time_string)
dir_name = 'playblasts {0}'.format(time_string)
root_path = r'/Users/johan/Desktop/test'
dir_path = os.path.join(root_path, dir_name)
#print(dir_path)
if not os.path.exists(dir_path):
os.makedirs(dir_path)
else:
print('Exists!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment