Mac OS
I have a file, images.tar.gz. , which contains about 7000 .png images. I need to unzip this file.
But when I use terminal to unzip it
tar zxvf /Users/JourneyWoo/images_002.tar.gz
I always encounter this problem
... ...
x images/00003910_000.png
x images/00001934_002.png
x images/00002250_001.png: gzip decompression failed
tar: Error exit delayed from previous errors.In this way, I cannot get the whole dataset in this .tar.gz file due to the break.
I also used chmod u+r /Users/JourneyWoo/images_002.tar.gz, but it did not work.
Maybe the problem about one of the png images in this .tar.gz file? How can I deal with this problem? REALLY THANKS!
33 Answers
The problem lies in the fact that Mac OS uses bsdtar. When I have a similar problem, I installed gnutar (most Linux systems use ).
brew install gnu-tar
gtar -ztvf archive.tar.gz 2 The file is corrupted. You need to try to get a good copy from wherever it came from, or if it was corrupted when created, you need to get it regenerated from the images. The problem has nothing to do with the .png files. The problem is that the .tar.gz is corrupted.
(By the way "unzip" is the wrong verb here, since it is not a zip file. "extract" would be the correct verb.)
1So this fails on a Mac (Ventura) using a tar pipeline. And it indeed is bsdtar. Trying to transfer entire home directory including all the weird files in Library. Saw the usual messages about sockets and the like but could not figure out which file this message might apply to. Not listing file names during the transfer.
This kept failing in random places. As root. What finally worked? cpio! It still had weird failures for individual files, but it copied all but 100 files of 220k.
# cd source-directory
# find . -depth -print | cpio -pdm /destination