Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

creating a directory

# Python program to explain os.mkdir() method 
  
# importing os module 
import os 
  
# Directory 
directory = "GeeksforGeeks"
  
# Parent Directory path 
parent_dir = "D:/Pycharm projects/"
  
# Path 
path = os.path.join(parent_dir, directory) 
  
# Create the directory 
# 'GeeksForGeeks' in 
# '/home / User / Documents' 
os.mkdir(path) 
print("Directory '% s' created" % directory) 
  
# Directory 
directory = "Geeks"
  
# Parent Directory path 
parent_dir = "D:/Pycharm projects"
  
# mode 
mode = 0o666
  
# Path 
path = os.path.join(parent_dir, directory) 
  
# Create the directory 
# 'GeeksForGeeks' in 
# '/home / User / Documents' 
# with mode 0o666 
os.mkdir(path, mode) 
print("Directory '% s' created" % directory)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #creating #directory
ADD COMMENT
Topic
Name
4+5 =