Generate folder-subfolders according to olddir
# https://majing.io/questions/772
import os from os import walk import shutil olddir = './identities_11/' newdir = './11/' ''' try: os.mkdir(newdir) except OSError: if not os.path.isdir(newdir): raise ''' for (dirpath, dirnames, filenames) in walk(olddir): os.mkdir(newdir+dirpath.split('/')[2],0755)