I am working on code in which I will create folders and sub folders based on a string retrieved from the database. It's dynamic; it could be one level, two levels, or ten.
I'm trying to replace the dots with slashes and create the proper tree, but this code below won't do the job:
for x in i.publish_app.split('.'):
    if not os.path.isdir(os.path.join(settings.MEDIA_ROOT, PATH_CSS_DB_OUT) + x + '/'):
        os.mkdir(os.path.join(settings.MEDIA_ROOT, PATH_CSS_DB_OUT) + x + '/')
i.publish_app is, for example, 'apps.name.name.another.name'.
How can I do it?
 
     
     
     
     
     
    