def name(a): '''Anti abs''' if U.inMuti(a,'/','\\',f=str.endswith):a=a[:-1] if not isAbs(a):return a else: a=T.sub(a,dir(a)) # U.repl() if U.inMuti(a,'/','\\',f=str.startswith):return a[1:] else:return a
def list(ap='.',r=False,type='',t='',d=False,dir=False,f=False,file=False): '''Parms:boll r recursion str (type,t) '(d,f,a,r)' default return all''' # print ap if dir:d=True if file:f=True if t and not type:type=t if 'd' in type:d=True if 'f' in type:f=True if 'a' in type:d=True;f=True if 'r' in type:r=True if d or dir or f or file:pass else:d=f=True #default return all if py.type(ap)!=py.type('') or py.len(ap)<1:ap='.' # if len(ap)==2 and ap.endswith(':'):ap+='/' if not U.inMuti(ap,'/','\\',f=str.endswith):ap+='/' # print ap # U.repl() ########## below r is result rls=[] try:r3=py.list(_os.walk(ap).next()) except Exception as ew: # print ap;raise ew return [] if ap=='./':ap='' # U.repl() r3[1]=[ap+i for i in r3[1]] r3[2]=[ap+i for i in r3[2]] if d:rls.extend(r3[1]) # if r: for i in r3[1]:rls.extend(list(i,r=r,d=d,f=f)) if f:rls.extend(r3[2]) return rls