This is so recursive, it hurts

# this is so recursive, it hurts
for topdir in args:
for root, dirs, files in os.walk(topdir):
for file in files:
for regexp in patterns:
if re.search(regexp, file):
file = os.path.join(root, file)
if verbose:
sys.stdout.write("file name: %st" % file)
p = os.stat(file)
a, m, t = (
time.strftime("%Y-%m-%dT%H:%M:%S",
time.gmtime(p.st_atime)),
time.strftime("%Y-%m-%dT%H:%M:%S",
time.gmtime(p.st_mtime)),
time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()), )
sys.stdout.write( "atime: %stmtime: %stnow: %sn" %
(a,m,t))
else:
print file

What a huge, ugly, monster, I’m glad the finished code doesn’t look like that lol.

1 thought on “This is so recursive, it hurts”

Comments are closed.