This snippet assumes that first argument is path to a file with list of paths, one per line. It is assumed that paths are valid, otherwise anything not valid is skipped over, since we cannot obtain modify time for it anyway.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
import datetime
DEFAULT = "./results.txt"
files = []
if __name__ == "__main__":
# If we don't have a path to file with information, we just assume there's
# a default at ./results.txt. Yes this is naive, but for current purpose
# it is sufficient.
try:
inp = sys.argv[1]
except:
inp = DEFAULT
f = open(inp, 'rb')
l = "."
while l != "":
l = f.readline()
path = l.strip('"|\n')
if not os.path.exists(path):
# Make sure we update `l` before arriving at this point again
continue
s = os.stat(path)
stamp = datetime.datetime.fromtimestamp(s.st_mtime)
files.append(tuple((stamp, path)))
sys.stdout.write("timestamp,path\n")
for t in files:
print "%s,%s" % t