def skipfile(file): if file in badnames or \ badprefix(file) or badsuffix(file) or \ path.islink(file) or path.isdir(file): return 1 # Skip huge files -- probably binaries. try: st = posix.stat(file) except posix.error: return 1 # Doesn't exist -- skip it return st[stat.ST_SIZE] >= MAXSIZE
def visit(pattern, dirname, names): if path.islink(dirname): names[:] = [] return if path.ismount(dirname): print 'descend into', dirname n = len(pattern) for name in names: name = path.cat(dirname, name) try: linkto = posix.readlink(name) if linkto[:n] = pattern: print name, '->', linkto except posix.error: pass
def main(): sys.stdout = sys.stderr progname = path.basename(sys.argv[0]) args = sys.argv[1:] if not args: print 'usage:', progname, 'path ...' sys.exit(2) status = 0 for name in args: if not path.islink(name): print progname + ':', name + ':', 'not a symlink' status = 1 else: if path.isdir(name): mkrealdir(name) else: mkrealfile(name) sys.exit(status)
def main(): sys.stdout = sys.stderr progname = path.basename(sys.argv[0]) args = sys.argv[1:] if not args: print 'usage:', progname, 'path ...' sys.exit(2) status = 0 for name in args: if not path.islink(name): print progname+':', name+':', 'not a symlink' status = 1 else: if path.isdir(name): mkrealdir(name) else: mkrealfile(name) sys.exit(status)