Python, Scripting

String To Folder

This tiny python script generates folder from a given string (template).

import os

out = "/Users/Nschlapmann/Documents/Python/Test"
out = out.replace("/", os.sep)
out = out.replace("\\", os.sep)

template = '''

folderArray = template.split("\n")
dataList = []

def checkSeperator(folder, startPos, endPos):
    if folder[startPos:endPos]=="-":
        return True
        return False

def checkStringRecursion(folder, level):
    if checkSeperator(folder, 0+folderLevel, 1+folderLevel): 
        folderLevel += 1
        checkStringRecursion(folder, folderLevel)
        if folderLevel>0:
            dataList.append([folderLevel, folder[folderLevel:len(folder)]])

def buildPathes():
    check = False
    for items in dataList:
        depth = items[0]
        name = items[1]
        if lowest_depth>=depth:
            lowest_depth = items[0]
            lowest_name = items[1]

        if check:
            if depth>depth_before:
                for ii in range (lowest_depth, i):
                    if dataList[ii][0]<depth:
                        tmp_name = dataList[ii][1]

                if tmp_name!="":
                    if tmp_name!=dataList[i][1]:

            check = True
        depth_before = items[0]
        name_before = items[1]

    for items in dataList:

def writeFolder():
    for items in dataList:

def main():
    if os.path.exists(out):
        for folder in folderArray:
            checkStringRecursion(folder, 0)
        print ("Folder created!")
        print ("Path dont exist!")
if  __name__ =='__main__':main()

The result: