tar

Python tarfile progress output?

Hello, I'm using the following code to extract a tar file: import tarfile tar = tarfile.open("sample.tar.gz") tar.extractall() tar.close() However, I'd like to keep tabs on the progress in the form of which files are being extracted at the moment. How can I do this? EXTRA BONUS POINTS: is it possible to create a percentage of the ex...

Pom.xml - tar task

Hi Is it possible to add a task to the pom.xml file that will create a tar.gz / .zip file. for eample: <tar type="tar.gz" source="resources/sql" tofile="target/sql.tar.gz"/> Thanks ...

Why does the tkinter progress bar makes things so much slower?

Hello, I have the following code for extracting a tar.gz file whilst keeping tabs on the progress: from __future__ import division import tarfile import os theArchive = "/Users/Dennis/Instances/atlassian-jira-enterprise-4.1.2-standalone.tar.gz" a = tarfile.open(theArchive) tarsize = 0 print "Computing total size" for tarinfo in a: ...

Can Ant's tar task set a Linux file permission even when the task is used on other platforms?

Starting with Ant 1.7, the TarFileSet is available which seems to allow file permission modifications in the tar archive. Does this feature work platform-independent, so that I can for example create a tar file on Windows and set execution permissions for script files in this archive which will have this flag if the file is unpacked on ...

Install a deb inside a chroot.

I have (or soon will have) a puppet script that installs a number of packages via apt-get. I need them to be accessible from inside a chroot. Is there an easy way to set that up? My first thought is to run apt-get from inside the chroot but that seems both messy and to be a potential problem as how can I be sure I've completely removed ...

Tarring only the files of a directory

If I have a folder with a bunch of images, how can I tar ONLY the images and not the folder structure leading to the images without having to CD into the directory of images? tar czf images.tgz /path/to/images/* Now when images.tgz is extracted, the contents that are extracted are /path/to/images/... How I can only have the images inc...

Mercurial Web Server - Why am I downloading a .bz2.tar file instead of a .tar.bz2 file?

It is my understanding that a .tar file contains directories and other files, and a .bz2 is a file that's compressed with bzip2 compression. Therefore, most tarballs with bzip2 compression end in: .tar.bz2 Which is bzip2 compression applied to a tarball. However, whenever I download source code from a Mercurial webserver, either the...

How to check if a shell command executed properly or not?

#!/bin/sh tar=$1 if [ -f $tar ] then tar xvf $tar else exit 1 fi ... <more code> I need a conformation that the tar actually happened successfully, otherwise abort the execution of the script. The tar file extract might not go through because some problems with tar command access issues with $tar Do Linux utilities have s...

How to extract a tar.gz archive in PHP without system()?

Hi, I have been wondering for couple of days: Is there a way to extract files from a .tar.gz archive in PHP without resorting to calling system commands with system()? (So: either with a built-in classes/functions or using an external free library?) I need it to work both on Windows (development) and Linux (deployment), if possible. T...

How do I compress a folder with the GZip module inside of Python?

The title says it all... I'm creating Python software that compresses files/folders... How would I create a section of the code that asks for the user input of the folder location and then compresses it. I currently have the code for a single file but not a folder full of files. Please explain in detail how to do this. Thanks! ...

How do I use subprocess to tar & compress a folder?

I have used the below code, it can compress folders. But when I uncompress folders, it will throw an error. I think there is something wrong with my code. Any advice is welcome. def compress_index(): "将/var/solr/core0/data索引目录进行打包压缩至同目录下,以该日时间命名的data.tar.gz.20101013形式的压缩包" parentdirs,folder=os.path.split(g_index_path) tar_fi...

Remove file in a tar, with wildcard and exception

I have a tarball, and i want to remove all .tcl, .bat , .log files except pkgIndex.tcl in it. if i do tar --delete -f mytarball.tar --wildcards *{.tcl,.log,.bat} my pkgIndex.tcl will be deleted, how to put that as exception in my pattern wildcard? Just tried tar --delete -f mytarball.tar --wildcards *{.tcl,.log} --exclude=*pkgIn...

How do I import a new release of a project into my git repository?

My repository looks like this. v1 - A - B - C ... where the commit v1 represents the contents of upstream-project-foo-0.9.8.tar.gz and the commits A, B ... are my modifications. The goal is to upgrade my copy of upstream-project and port the commits A, B, C ... to it. How do I get a new version of the upstream-project tarball into m...

tar: Error is not recoverable: exiting now

Hello, when I untar doctrine -rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz I always get this error messages root@X100e:/usr/local/lib/Doctrine/stable# tar -xvzf Doctrine-1.2.0.tgz . . . Doctrine-1.2.0/tests/ViewTestCase.php Doctrine-1.2.0/CHANGELOG gzip: stdin: decompression OK, trailing garbage ignored Doctri...

Unix script to find all folders in the directory

Basically I need to run a Unix script to find all folders in the directory /fss/fin, if it exists; then I have tar it and move to another directory /fs/fi. This is my command so far: find /fss/fin -type d -name "essbase" -print Here I have mentioned folder name essbase instead of that I have to find all the folder in the /fss/fin. ...

Prevent parent directories from being tarred

Basically I just want to tar all the files in a directory, but not get all the parent directories in the archive. I've tried -C, but I guess I'm not using it right. tar -cjf archive.tar.bz2 -C /var/some/log/path ./* This results in tar trying to add all the files in the CWD. Using the full path as last argument doesn't prevent the di...