3 # Copy one file's atime and mtime to another
7 from stat import ST_ATIME, ST_MTIME # Really constants 7 and 8
10 if len(sys.argv) <> 3:
11 sys.stderr.write('usage: copytime source destination\n')
13 file1, file2 = sys.argv[1], sys.argv[2]
15 stat1 = os.stat(file1)
17 sys.stderr.write(file1 + ': cannot stat\n')
20 os.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME]))
22 sys.stderr.write(file2 + ': cannot change time\n')
25 if __name__ == '__main__':