Advertisement
rfmonk

shutil_copy2.py

Jan 28th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. from shutil import *
  5. import os
  6. import time
  7.  
  8.  
  9. def show_file_info(filename):
  10.     stat_info = os.stat(filename)
  11.     print '\tMode   :', stat_info.st_mode
  12.     print '\tCreated:', time.ctime(stat_info.st_ctime)
  13.     print '\tAccessed:', time.ctime(stat_info.st_atime)
  14.     print '\tModified:', time.ctime(stat_info.st_mtime)
  15.  
  16. os.mkdir('example')
  17. print 'SOURCE:'
  18. show_file_info('shutil_copy2.py')
  19. copy2('shutil_copy2.py', 'example')
  20. print 'DEST:'
  21. show_file_info('example/shutil_copy2.py')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement