Back to index

python3.2  3.2.2
Functions
copytime Namespace Reference

Functions

def main

Function Documentation

def copytime.main ( void  )

Definition at line 9 of file copytime.py.

00009 
00010 def main():
00011     if len(sys.argv) != 3:
00012         sys.stderr.write('usage: copytime source destination\n')
00013         sys.exit(2)
00014     file1, file2 = sys.argv[1], sys.argv[2]
00015     try:
00016         stat1 = os.stat(file1)
00017     except os.error:
00018         sys.stderr.write(file1 + ': cannot stat\n')
00019         sys.exit(1)
00020     try:
00021         os.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME]))
00022     except os.error:
00023         sys.stderr.write(file2 + ': cannot change time\n')
00024         sys.exit(2)