I woke up this morning 15/09/2019 and i was building a web based application that i wanted to list, create and delete files from a directory using a php (hypertext preprocessor).

Firstly I need to create the Directory and put in files which i need to list, create and delete using PHP codes but along the line i did a practical work with python scripting

HOW to create a folder with a python codes

The below codes can see you all the way to perform crucial task of creating a folder (new directory).

import os  def createFolder(directory):     try:         if not os.path.exists(directory):             os.makedirs(directory)     except OSError:         print ('Unable to Create directory. ' +  directory +': Error')           # Here creates a folder (shopinson) in the current directory the this python file resides in createFolder('./shopinson/')  

the above Python Codes creates a folder called (shopinson) in the current directory the this python file resides in

LEAVE A REPLY

Please enter your comment!
Please enter your name here