def make_dir_struct(tag, base, out_base):
 lbase = len(base)
 pathsep = os.path.sep
 lpathsep = len(pathsep)
 out = []
 for (dirpath, dirnames, filenames) in os.walk(base):
  dp_eff = dirpath[lbase:]
  if dp_eff.startswith(pathsep):
   dp_eff = dp_eff[lpathsep:]
  out_path = pjoin(out_base, dp_eff)
  pfiles = [pjoin(dirpath, f) for f in filenames]
  out.append((out_path, pfiles))
 return out

def make_dir_struct ( tag , base , out_base ) : lbase = len ( base ) pathsep = os . path . sep lpathsep = len ( pathsep ) out = [ ] for ( dirpath , dirnames , filenames ) in os . walk ( base ) : dp_eff = dirpath [ lbase : ] if dp_eff . startswith ( pathsep ) : dp_eff = dp_eff [ lpathsep : ] out_path = pjoin ( out_base , dp_eff ) pfiles = [ pjoin ( dirpath , f ) for f in filenames ] out . append ( ( out_path , pfiles ) ) return out
make the directory structure of all files below a starting dir .