def create_tree(base_dir, files, mode=511, verbose=1, dry_run=0):
 need_dir = {}
 for file in files:
  need_dir[os.path.join(base_dir, os.path.dirname(file))] = 1
 need_dirs = need_dir.keys()
 need_dirs.sort()
 for dir in need_dirs:
  mkpath(dir, mode, verbose=verbose, dry_run=dry_run)

def create_tree ( base_dir , files , mode = 511 , verbose = 1 , dry_run = 0 ) : need_dir = { } for file in files : need_dir [ os . path . join ( base_dir , os . path . dirname ( file ) ) ] = 1 need_dirs = need_dir . keys ( ) need_dirs . sort ( ) for dir in need_dirs : mkpath ( dir , mode , verbose = verbose , dry_run = dry_run )
create all the empty directories under base_dir needed to put files there .