def subfiles(d):
 r = []
 stack = [([], d)]
 while stack:
  (p, n) = stack.pop()
  if os.path.isdir(n):
   for s in os.listdir(n):
    if (s[:1] != '.'):
     stack.append(((copy(p) + [s]), os.path.join(n, s)))
  else:
   r.append((p, n))
 return r

def subfiles ( d ) : r = [ ] stack = [ ( [ ] , d ) ] while stack : ( p , n ) = stack . pop ( ) if os . path . isdir ( n ) : for s in os . listdir ( n ) : if ( s [ : 1 ] != '.' ) : stack . append ( ( ( copy ( p ) + [ s ] ) , os . path . join ( n , s ) ) ) else : r . append ( ( p , n ) ) return r
return list of tuples for all the files in directory d .