Python Backup Script

Source: Internet
Author: User

#!/usr/bin/python#-*-coding:utf-8-*-#Filename:backUp.py#Import TemplateImportTkinterImportOSImport Time#define functions, here's the essence.defbackup ():GlobalEntry_sourceGlobalEntry_target Source=entry_source.get () Target_dir=entry_target.get () Today_dir= Target_dir + time.strftime ('%y%m%d') Time_dir= Time.strftime ("%h%m%s") Touch= Today_dir + os.sep + time_dir +'. zip'Command_touch="ZIP-QR"+ Touch +' '+SourcePrintCommand_touchPrintSourcePrintTarget_dirifOs.path.exists (today_dir) = =0:os.mkdir (Today_dir)ifOs.system (command_touch) = =0:Print 'Success backup up'    Else:        Print 'Failed Backup'#Initialize the window and set the caption and sizeRoot =tkinter.tk () root.title ('BackUp') Root.geometry ("200x200")#label为文本框, entry is the input box, grid () is the display functionLbl_source = Tkinter.label (Root, text='Source') Lbl_source.grid (Row=0, column=0) Entry_source=tkinter.entry (Root) entry_source.grid (row=0,column=1)#two controls in the second rowLbl_target = Tkinter.label (Root, text='Target') Lbl_target.grid (Row=1, column=0) Entry_target=tkinter.entry (Root) entry_target.grid (row=1,column=1)#a button control on the third rowBut_back = Tkinter.button (root,text='BackUp') But_back.grid (Row=3, column=0) but_back["Command"] =Backup#the beginning of the interfaceRoot.mainloop ()

Python Backup Script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.