Questions tagged [tarfile]

either a tar archive file or a Python module used to handle tar archive files

The term "tar file" can refer to either an archive file created with the UNIX tar command (also called a tarball) or the Python tarfile module that is used to read, write, and manage these files.

Resources

Related Tags

231 questions
0
votes
0 answers

Python tarfile gzipped file bigger than sum of source files

I have a Python routine which archives file recordings into a GZipped tarball. The output file appears to be far larger than the source files, and I cannot work out why. As an example of the scale of the issue, 6GB of call recordings are generating…
btongeorge
  • 421
  • 2
  • 12
  • 23
0
votes
1 answer

Python tarfile not creating valid .tar.gz file

I have a Django app that creates a .tar.gz file for download. Locally, I run on my dev machine Python 2.7, and on my remote dev server, Python 2.6.6. When I download the files, I can open both via Mac Finder / command line and view the contents.…
user
  • 4,651
  • 5
  • 32
  • 60
0
votes
0 answers

Python tarfile error - gzip module not available

I have the following code import tarfile for archive in archives: tar = tarfile.open(archive, "r:gz") tar.extractall() tar.close() where archives is list of files with .tar.gz extension. Although it crashes while trying to open tar.gz…
user1967718
  • 835
  • 1
  • 13
  • 22
0
votes
1 answer

Where can I store extracted program files from a Python package?

I have written a Python package hwrt which comes with a model.tar file. Neither the file itself nor the contents should bother users (they can take a look at it, it's not a secret - but they don't need it). I need to work with files in that archive.…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
0
votes
1 answer

Python tarfile fails

I am trying to write a script that tar a directory and scp's to a server which have lots of tar files. I am having trouble in creating tar of the directories, here is the complete script. Why is that happening? Code: #!/usr/bin/python import…
vector8188
  • 1,293
  • 4
  • 22
  • 48
0
votes
1 answer

How to avoid overwrite of files

we are using tarFile library of python to untar the set of given files to the target directory. tarGzipFile = tarfile.open(fileName) tarGzipFile.extractall(targetDir + '/') Here if same file exists in more than one tar.gz file then the file is…
0
votes
1 answer

Python: How to take tar using tarfile module by excluding the 3rd directory

I have the directory structure like this -- jenkins |-- jobs | |-- dir1 | | |-- build_dir-- | | `-- Autoyes | |-- dir2 | | |-- build_dir-- | | `-- Manyes | |-- dir3 | | |-- ArtFict | | `-- build_dir-- | `-- hi |--…
Prabhu Are
  • 23
  • 6
0
votes
1 answer

Python: Get single file in a TAR from FTP

I have an ftp server that contains all of my tar files, those tar files are as big as 500MB+, and they are too many and all I needed to do is to get a single file from a TAR that contains multiple files which becomes 500MB+. My initial idea is to…
lexsanjose
  • 31
  • 4
0
votes
3 answers

How to unpack 7-Zip.gz (.gz) with Python?

I have a .tar.gz file which I want to unpack (when I unpack with 7-Zip manually, I am getting a .tar file inside). I am able to unpack this .tar file easily then with Python tarfile module then. When I right-click the .tar.gz file in Windows…
Alex Tereshenkov
  • 3,340
  • 8
  • 36
  • 61
0
votes
0 answers

Python: Unpack a list of tar files

i want to extract all files from multiple tar-archives, but whatever i do, it won't work. Lets say, i have two tar files in C:\Temp. So i thought, all i have to do is to get a list of the *.tar files in C:\temp, and extract it with a loop: import…
Fabster
  • 133
  • 1
  • 5
0
votes
1 answer

How to avoid tarfile so that Images should NOT retain the path

I am using the tarfile module to compress the image files. But when I compress the images it retain the total path for the images where they are placed. They should be relative. Means if the Images are placed at location a/b/c/demo_images.png then…
Sagar
  • 2,315
  • 7
  • 25
  • 34
0
votes
0 answers

how to automate zipping of files from sql

I have an SQL table which has results for each period(e.g. Jan 2013). These are the steps that I follow: I want to select records from each period. Put the results into a CSV file. Then copy the headers and save the CSV file to a text file with…
0
votes
2 answers

Alternative of "extractall()" of tarfile module in python version 2.4

extractall() from the tarfile module in not present in Python v2.4 Can you suggest any alternate approach to extract a tarfile in Python v2.4?
Black_Hat
  • 943
  • 1
  • 9
  • 12
-1
votes
1 answer

Python tar file module shows two files with same name, except one begins with _

I have a tarfile with 3 files in it, file1, file2, file3. When I use the Python tarfile module to view the files in the tarfile, the module shows 6 files, the three that I have, and it prepends an underscore to each of them. I am not sure…
Bruce Banner
  • 193
  • 1
  • 12
-1
votes
1 answer

How can I create filename.TAR.GZ (ext. In upper case only) using Python tarfile package

I am using the tarfile package for python. Tar = tarfile.open("filename.tar.gz" mode='w:gz') NOTE: tarfile.open("filename.**TAR.GZ**" mode='w:gz') is creating two levels of compression. no idea if it is a bug in the package It is creating…
1 2 3
15
16