Advertisement
stuppid_bot

Copy project to archive

Jun 2nd, 2014
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. # -*- coding: utf8 -*-
  2. import os
  3. import shutil
  4. from time import time
  5. project_directory_path = '..'
  6. archive_directory_name = 'ver'
  7. archive_directory_path = project_directory_path + '/' + archive_directory_name  + '/' + str(int(time()))
  8. try:
  9.     os.makedirs(archive_directory_path)
  10. except:
  11.     pass
  12. items = os.listdir(project_directory_path)
  13. for item in items:
  14.     if item == archive_directory_name:
  15.         continue
  16.     src = project_directory_path + '/' + item
  17.     dst = archive_directory_path + '/' + item
  18.     if os.path.isdir(src):
  19.         shutil.copytree(src, dst)
  20.     else:
  21.         shutil.copy2(src, dst)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement