最近玩MITE(minecraft is too easy)前期老是被小白两箭搞死,每次探矿还要手动备份,一忘记备份就很难受,所以写了个自动备份的脚本 -,-
路径看情况改一下吧,MITE简直就是恐怖游戏,里面的怪物AI有点强..搞阴的那一套wocao
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| import time import shutil import datetime from queue import Queue
backup_version = 10 backup_time = 60 * 3
def main(): q=Queue(maxsize=backup_version) while(True): now = datetime.datetime.now() original_folder = 'MITE Plus R5/.minecraft/MITE/saves/1.6.4/极其险恶的世界1' target_folder = 'bf/极其险恶的世界1'+str(now.strftime('%Y%m%d%H%M%S')) shutil.copytree(original_folder, target_folder) print(str(now.strftime('%Y-%m-%d %H:%M:%S') + ': backup success! -- ' + target_folder))
q.put(target_folder) if q.full(): delete_folder = q.get() shutil.rmtree(delete_folder, True)
i = backup_time while (i>0): print('\r next backup time left: %3d' %(i), end='') i-=1 time.sleep(1) print('')
if __name__ == '__main__': main()
|