[Tutor] backup failed - gzip

Liam Clarke cyresse at gmail.com
Fri Dec 3 07:46:14 CET 2004


As the below quote from the manual shows - 

On Windows, the return value is that returned by the system shell
after running command, given by the Windows environment variable
COMSPEC: on command.com systems (Windows 95, 98 and ME) this is always
0; on cmd.exe systems (Windows NT, 2000 and XP) this is the exit
status of the command run; on systems using a non-native shell,
consult your shell documentation.

Your return value is OS specific. What OS are you using? Did you check
to see if your zip files were created? It may just be a funky return
code.

On Fri, 3 Dec 2004 12:08:25 +0600, Ramkumar Parimal Alagan
<ramster6 at gmail.com> wrote:
> 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 ?
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list