[Tutor] writing sample program that zips files and saves in a backup directory

David Eric ciik13 at gmail.com
Tue Oct 13 22:38:24 CEST 2009


On Tue, Oct 13, 2009 at 4:02 PM, Kent Johnson <kent37 at tds.net> wrote:

> On Tue, Oct 13, 2009 at 2:58 PM, David Eric <ciik13 at gmail.com> wrote:
> > printing the command line,
> > would it be
> >  print('gzip {0} {1}'.format(target, ' '.join(source))?
>
> Yes, or just
>  print zip_command
>
> > and as far as using the tar command,
> > i have three files,
> > file1,file2,file3
> > i wanted to preserve that structure, doesnt tar combine everything into
> one
> > file?
>
> Yes, tar makes a single file. Do you want to preserve the individual
> files? Why did you have the .gz argument in your command line? Is that
> supposed to be a directory name or a file name?
>
> My understanding of the man page is that gzip *replaces* files with
> their gzipped version, so I guess if you want to back up a directory
> to gzipped files you would have to first copy the directory, then
> gzip.
>
> BTW you might like to look at the zipfile module as an alternative to gzip.
>
> Kent
>
> PS Please Reply All to reply to the list.
>
yes Dave told me to stop top posting and CC tutor at python.org..sorry about
that i didnt know.

as far as print zip_command, i would add that to the program however, doesnt
just declaring it actually trigger it..thus it would executed and the
command line would get printed as well?

the actual program i was looking to write would take:
 file1,file2,and file3, in /Users/davidteboul/bin/python
and condense them into individual files; file1.gz, file2.gz and file3.gz and
save them in a directory already made - (/Users/davidteboul/backups)


ps..did i post and reply all corretly?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091013/9323d26e/attachment-0001.htm>


More information about the Tutor mailing list