filebackup.py

 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

 

posted @ 2017-04-10 22:14  puer633  阅读(100)  评论(0编辑  收藏  举报