def packnotolder(outfp, dirname, oldest): names = mac.listdir(dirname) oldest = macpath.cat(dirname, oldest) st = mac.stat(oldest) mtime = st[ST_MTIME] todo = [] for name in names: print name, '...', st = mac.stat(macpath.cat(dirname, name)) if st[ST_MTIME] >= mtime: print 'Yes.' todo.append(name) else: print 'No.' todo.sort() packsome(outfp, dirname, todo)
def isdir(s): try: st = mac.stat(s) except mac.error: return 0 return S_ISDIR(st[ST_MODE])
def exists(s): try: st = mac.stat(s) except mac.error: return 0 return 1
def isfile(s): try: st = mac.stat(s) except mac.error: return 0 return S_ISREG(st[ST_MODE])