码迷,mamicode.com
首页 > 其他好文 > 详细

filebackup.py

时间:2017-04-10 23:42:51      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:backup   back   alt   class   os.path   utf-8   sys   raw   code   

 1 #coding=utf-8
 2 import os
 3 import time
 4 while 1:
 5     os.system(ls)
 6     oldfilename=raw_input("input file‘s name which you want backup:")
 7     if os.path.exists(oldfilename):
 8         now=time.strftime(%Y%m%d%H%M,time.localtime())
 9         bakfilename=oldfilename+now
10         os.system(cp %s %s  %(oldfilename,bakfilename))
11         print -----done------
12         exit(0)
13     else:
14         print %s not existed! %oldfilename

 

filebackup.py

标签:backup   back   alt   class   os.path   utf-8   sys   raw   code   

原文地址:http://www.cnblogs.com/puer633/p/6691242.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!