Mercurial > cpython-lru_cache-weakref
annotate Tools/scripts/copytime.py @ 3044:7e7bb00a0a2e legacy-trunk
Added functionality: locate CW projects, copy them, empty them and
binhex them.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Thu, 31 Aug 1995 13:47:14 +0000 |
| parents | 28948181fb2f |
| children | 73758db2f464 |
| rev | line source |
|---|---|
|
1269
28948181fb2f
*** empty log message ***
Guido van Rossum <guido@python.org>
parents:
758
diff
changeset
|
1 #! /usr/local/bin/python |
| 500 | 2 |
| 3 # Copy one file's atime and mtime to another | |
| 4 | |
| 5 import sys | |
| 758 | 6 import os |
| 500 | 7 from stat import ST_ATIME, ST_MTIME # Really constants 7 and 8 |
| 8 | |
| 9 def main(): | |
| 10 if len(sys.argv) <> 3: | |
| 11 sys.stderr.write('usage: copytime source destination\n') | |
| 12 sys.exit(2) | |
| 13 file1, file2 = sys.argv[1], sys.argv[2] | |
| 14 try: | |
| 758 | 15 stat1 = os.stat(file1) |
| 16 except os.error: | |
| 500 | 17 sys.stderr.write(file1 + ': cannot stat\n') |
| 18 sys.exit(1) | |
| 19 try: | |
| 758 | 20 os.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME])) |
| 21 except os.error: | |
| 500 | 22 sys.stderr.write(file2 + ': cannot change time\n') |
| 23 sys.exit(2) | |
| 24 | |
| 25 main() |
