def get_directory_node(path):
    node = Node(os.path.split(path)[1])
    if os.path.isdir(path):
        for itemName in os.listdir(path):
            fullPath = os.path.join(path,itemName)
            node.addSubNode(get_directory_node(fullPath))
    return node