skipping: file.txt need PK compat. v4.5 (can do v2.1)
I am going to give a background on why I am writing about this error. If you need to know how to fix it, go to the section that says, using p7zip.
The reason I began using a unix emulator (cygwin) was so that I can accomplish row counts on large data files. The counts needed to be completed prior to being uploaded to a database.
The files I was given were large in nature (3-4 gigs on average). They were provided to me in a DVD as compressed files. Sometimes they were compressed as .zip, .gz and .rar files
Cygwin comes equipped with gunzip by default, at least I don't remember having to install it. So for the gzip files, I would write:
gunzip -d archive_name.gz
This will not only extract your file, but it will get rid of the gz file and only leave the archived contents.
For the initial zip files that I encountered, I used:
unzip zip_file_name.zip
This did the trick until I received the following error: skipping: file.txt need PK compat. v4.5 (can do v2.1) where file.txt was the name of my file.
I know that a utility called PKzip existed so I thought that perhaps if I revert to my cygwin installer, I can look for the package download it and use it so that I can extract my .zip archive. Well I looked for what seemed to be a while until I gave up. I did not find a PKzip package for cygwin but I did find p7zip.
To get p7zip under cygwin
- click on your original setup.exe file for cygwin.
- Follow through the wizard the same way that you did the first time.
- Then when you get to the "Select Packages" section, expand the Archive software packages.
- Select the one that says p7zip
- Complete the wizard.
Using p7zip
If you skipped to this section, it is because you probably received an error ( skipping: file.txt need PK compat. v4.5 (can do v2.1) )when extracting a zip file with unix unzip command.
instead of using:
unzip zip_file_name.zip
use your p7zip utility to extract the contents. Type the following to extract the archived file.
7z -e zip_file_name.zip
A question that you might of had when looking for this solution is, does p7zip handle pkzip archives? The answer is yes! Fortunately it does. This allowed me script all my steps. Below is a sample shell script that I wrote to execute what I would have otherwise done manually.
#Begin of shell script
#This shell script will
# 1.) Unzip the contents of the zip archive
# 2.) Remove the zip archive after the contents are extracted
# 3.) Count the number of lines in the archive (usually a text file). You should know the text file's name that will be extracted.
# 4.) Delete the file after the rows have been counted.
7z e zip_file_name.zip;
rm zip_file_name.zip;
wc -l contents_inside_zip_file.txt;
rm contents_inside_zip_file.txt;
#end of the program
# if you don't know the name of the file to be extracted
# or you will be extracting many files from that .zip file
# replace the last two lines with
# wc -l . *
# this will count all the lines in all the files
This is a blog post so post questions if you have any.