I am trying to create a directory using Python on UNIX.
This is my code:
import os, sys
if len(sys.argv) > 2:
print "USAGE : createDir <codeset>"
sys.exit()
rootName= sys.argv[1]
# setting $HOME and $DATA path
home_path = "/opt/app/" + rootName+ "/"
data_path = "/data/app/" + rootName + "/"
# creating rootName directory
os.makedirs(home_path , 0755)
os.makedirs(data_path , 0755)
# create data and log folder in data_path
os.makedirs(data_path + "data")
os.makedirs(data_path + "log")
# create J2SEDomain and scripts folders
os.makedirs(home_path + "J2SEDomain")
os.makedirs(home_path + "scripts")
print "All folders created successfully."
Now I want to know if the permission I set for the rootName folder applies for all the subfolders inside it or only for the rootName folder alone.
Also please tell me how to efficiently write the above code as I am new to Python.
EDIT: I am not checking the permission explicitly but asking what will be the default permission for the sub-folders inside a folder which has permission set to 0755