Index: branches/ariel/xmldumps-backup/WikiDump.py |
— | — | @@ -87,6 +87,17 @@ |
88 | 88 | else: |
89 | 89 | return FileUtils._prettySize(size / 1024.0, quanta[1:]) |
90 | 90 | |
| 91 | + def fileInfo(path): |
| 92 | + """Return a tuple of date/time and size of a file, or None, None""" |
| 93 | + try: |
| 94 | + timestamp = time.gmtime(os.stat(path).st_mtime) |
| 95 | + timestamp = time.strftime("%Y-%m-%d %H:%M:%S",timestamp) |
| 96 | + size = os.path.getsize(path) |
| 97 | + return (timestamp, size) |
| 98 | + except: |
| 99 | + raise |
| 100 | + return(None, None) |
| 101 | + |
91 | 102 | fileAge = staticmethod(fileAge) |
92 | 103 | atomicCreate = staticmethod(atomicCreate) |
93 | 104 | writeFile = staticmethod(writeFile) |
— | — | @@ -96,6 +107,7 @@ |
97 | 108 | relativePath = staticmethod(relativePath) |
98 | 109 | prettySize = staticmethod(prettySize) |
99 | 110 | _prettySize = staticmethod(_prettySize) |
| 111 | + fileInfo = staticmethod(fileInfo) |
100 | 112 | |
101 | 113 | class TimeUtils(object): |
102 | 114 | |