#!/usr/bin/python

# -*- coding: utf-8 -*-

#filename back.py

#author superchen


import os

import time

source ='/home/shiyanlou/Documents/'

target_dir = '/home/shiyanlou/Desktop'

target = target_dir+time.strftime('%Y-%m-%d-%H-%M-%S')+'.zip'

zip_command = "zip -qr %s %s" %(target,''.join(source))

#q命令是安静运行r命令是递归的执行

if os.system(zip_command)==0:

    print 'sucessful backup'

else:

    print "backup failed"