[Tutor] gzip (fwd)
cyresse at gmail.com
Sat Dec 4 07:08:13 CET 2004
>target_dir = 'D:\\backup'
>target = target_dir +"Zipnametoreplacestrftimeformatstring"+ '.zip'
Just noticed this -
target_dir("D:\\backup") + "Zipnametoreplacestrftimeformatstring"+ '.zip'
No wonder it doesn't work.
target=target_dir+'\\'+time.strftime('%Y%m%d%H%M%S') + '.zip'
PS Yes, do use reply to all
On Fri, 3 Dec 2004 15:16:27 +0600, Ramkumar Parimal Alagan
<ramster6 at gmail.com> wrote:
> I have only 2 word documents in both the directories, i tried removing
> '-qr' too, but no change, no zip files formed. i'm using windows XP.
> On Thu, 2 Dec 2004 23:54:11 -0800 (PST), Danny Yoo
> <dyoo at hkn.eecs.berkeley.edu> wrote:
> > Hi Ramkumar,
> > I'm forwarding your message to Python-tutor; in your replies, please make
> > sure that you are using the "reply-to-all" feature in your email client.
> > This will allow your response to reach the others on the tutor list.
> > Don't rely on me alone: give the community the chance to help you.
> > I don't have enough information to pinpoint what the problem is yet. I'll
> > have to ask more questions, and others on the Tutor list will probably
> > also ask a few questions. Please try to answer them, because that will
> > help us give a better idea of what the problem is.
> > It looks like you are trying to zip up whole directories. Does the
> > program work if you zip up single files?
> > It also appears that you're using the '-q' and '-r' options of the 'zip'
> > command line utility. '-q' stands for 'quiet' mode, and although that's
> > nice when the command is working properly, it's not helpful when you're
> > debugging a situation. Try turning quiet mode off, so that you have a
> > better chance of getting good error output from the zip command. Even
> > better, try enabling verbose mode, so you can see better what 'zip' is
> > attempting to do.
> > Do you see anything else when you execute the program? Does anything else
> > come out of standard error?
> > Good luck to you.
> > ---------- Forwarded message ----------
> > Date: Fri, 3 Dec 2004 10:24:15 +0600
> > From: Ramkumar Parimal Alagan <ramster6 at gmail.com>
> > To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
> > Subject: Re: [Tutor] gzip
> > 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 ?
> << The end depends upon the beginning. >>
> Tutor maillist - Tutor at python.org
'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