Created
March 10, 2017 03:42
-
-
Save keithweaver/562d3caa8650eefe7f84fa074e9ca949 to your computer and use it in GitHub Desktop.
Create a folder with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def createFolder(directory): | |
try: | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |
except OSError: | |
print ('Error: Creating directory. ' + directory) | |
# Example | |
createFolder('./data/') | |
# Creates a folder in the current directory called data |
best code I have ever found, thx!
Thank you!
how to create a folder with name in format yyyy-mm-dd from any year to today
thank you man ``
Great! Thanks so much!
Thank you, very useful and helped me understand the command.
NIce! Thanks for posting.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@khu17jain Write two makedirs statements to the same location. For loop it if you have a lot.