9 examples of 'python create folder' in Python

Every line of 'python create folder' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
54def create_folder(module, dt, dn):
55 """
56 Creates directories for module and their __init__.py
57 """
58 import webnotes, os
59
60 # get module path by importing the module
61 modules_path = get_module_path(module)
62
63 code_type = dt in ['DocType', 'Page', 'Search Criteria']
64
65 # create folder
66 folder = os.path.join(modules_path, code_type and scrub(dt) or dt, code_type and scrub(dn) or dn)
67
68 webnotes.create_folder(folder)
69
70 # create init_py_files
71 if code_type:
72 create_init_py(modules_path, scrub(dt), scrub(dn))
73
74 return folder
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

22def create_folder(folder):
23 """ Create folders to retrieve posters and thumbnails
24 """
25 print(folder)
26 if not os.path.exists(folder):
27 os.makedirs(folder)
49def create_folder(path):
50 """
51 Create a folder if not exists
52 :param path: The path
53 """
54 if not folder_exists(path):
55 xbmcvfs.mkdirs(path)
87def create_folders():
88 # obtain the ip address and the date
89 ipAddress = safeexec("ifconfig edge0 | awk '/inet addr/ {gsub(\"addr:\", \"\", $2); print $2}'")
90 date = safeexec("date +'%Y-%m-%d_%H-%M-%S'")
91
92 # create folder name and path
93 folderName = ipAddress + "_" + date
94 folderPath = "/home/ubuntu/" + folderName
95 safeexec("mkdir " + folderPath)
96
97 # this file name has to change for every peer
98 netstatFileName = "netstat_" + ipAddress + ".txt"
99 netstatFilePath = folderPath + "/" + netstatFileName
100 safeexec("touch " + netstatFilePath)
101
102 start_ifstat(netstatFilePath)
169def create(self):
170 self.parent.create_folder(self.name)
189def makeFolder(folderName, display_Str) :
190 if not os.path.exists(folderName) :
191 os.makedirs(folderName)
192
193 strToPrint = "..Folder " + display_Str + " created..."
194 print strToPrint
195
196
197 from os import listdir
58def check_folder(folder):
59 if not os.path.exists(folder):
60 try:
61 os.makedirs(folder)
62 except OSError as e:
63 if e.errno != errno.EEXIST:
64 raise
65 return True
33def make(folder):
34 if not os.path.exists(folder):
35 os.makedirs(folder)
46def create_folder(path):
47 os.makedirs(path)
48 msg = f"created folder: {path}"
49 print(msg)

Related snippets