[Tutor] backup failed - gzip

Ramkumar Parimal Alagan ramster6 at gmail.com
Fri Dec 3 07:08:25 CET 2004


This is what i intend to do:

1. The files and directories to be backed up are given in a list.
2. The backup must be stored in a main backup directory.
3. The files are backed up into a zip file.
4. The name of the zip archive is the current date and time.

the coding:

______________

import os
import time

source = ['D:\\down', 'D:\\Pics']

target_dir = 'D:\\backup'

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

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

if os.system(zip_command) == 0:
    print 'Successful backup to', target
else:
    print 'Backup FAILED'

_____________________________

result : Backup FAILED

whats wrong ?


More information about the Tutor mailing list