Create TarFile using python
I have a problem. I'm new in python and I need a script that group a list of files using Tar file utility and then, compress that block using a compress utility (gzip i think). I already found some information and i try to apply it, but my scripy doesn't work. The first problem is when I had tried to open the file that i want to group, a IO error appear: f = open(log, "r") IOError: [Errno 13] Permission denied: 'C:\\path" I previusly asigned to "log" the path of the archive that i want to group could sombody helpme???. -- http://mail.python.org/mailman/listinfo/python-list
Re: Create TarFile using python
yes, i did. I'm checking the link in ASPN and I think that it'll works for "my problem" thanks a lot!! One more question... I'll need do it frecuently: add more directories into the same block. Is the same procedure? Thanks!!! ps. sorry about gramatic, I don't write english frecuently Yu-Xi Lim ha escrito: > Peter Maas wrote: > > > Did you look here?: > > > > http://docs.python.org/lib/tar-examples.html > > > > Peter Maas, Aachen > > It doesn't show him how to archive a directory. -- http://mail.python.org/mailman/listinfo/python-list
ReadError, "not a bzip2 file"
Hello!! In using tarfile to group thousands of small files from a directory and then compress it. I already compress a group of files in my pc, but I need do it in a server and I'm testing the same procedure, but it doesn't work . A "ReadError" appear: "not a bzip2 file". I'm using this script: import os import tarfile dstfolder = '/somepath/to/output'## server fileorfoldertobackup = '/home/username' ## server dst = '%s.tar.bz2' % os.path.join(dstfolder, os.path.basename(fileorfoldertobackup)) out = tarfile.TarFile.open(dst, 'w:bz2') out.add(fileorfoldertobackup, arcname=os.path.basename(fileorfoldertobackup)) out.close() What I´m doing wrong? Is necesary install a python version into the server?? Thanks!! -- http://mail.python.org/mailman/listinfo/python-list