Advertisement
rfmonk

shutil_copystat.py

Jan 28th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 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. with open('file_to_change.txt', 'wt') as f:
  17.     f.write('content')
  18. os.chmod('file_to_change.txt', 0444)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement