Как исправить error with unzip

I tried to extract my file on the linux command line:

unzip myfile.zip

But this error occurred:

unzip: cannot find or open myfile.zip, myfile.zip.zip or myfile.zip.ZIP

o11c's user avatar

o11c

15.1k4 gold badges50 silver badges74 bronze badges

asked Jun 23, 2015 at 9:40

Zay Ya's user avatar

2

unzip cannot find the file myfile.zip. Make sure the file exists in your current working directory. You can also try to provide an absolute path.

answered Jun 23, 2015 at 9:44

NaN's user avatar

NaNNaN

7,2214 gold badges31 silver badges51 bronze badges

4

unzip -d /zip osTicket-v1.10.zip

/zip is a directory
osTicket-v1.10.zip = zip file

answered Mar 9, 2018 at 9:31

Thulasidhasan .M's user avatar

Make sure the folder was not partially transferred. I got this error due to an incomplete folder sftp. When I re-transferred it unzipped fine.

answered Oct 29, 2019 at 18:59

kxb35's user avatar

kxb35kxb35

415 bronze badges

If your zip file contain space like «my file.zip» try to remove/replace space in my case i renamed «my_file.zip» and then the command (unzip my_file.zip) worked fine.

answered Feb 2, 2017 at 21:35

A.Aleem11's user avatar

A.Aleem11A.Aleem11

1,82415 silver badges12 bronze badges

Given a script generating 100 .zip files, of which some are empty. (Even if there is nothing to zip, my script generate 100 .zip files).

Given the command :

unzip *.zip

I get an error on empty files :

unzip:  cannot find zipfile directory in one of ./data/Archive_03.zip or
        ./data/Archive_03.zip.zip, and cannot find ./data/Archive_03.zip.ZIP, period.

How can I bypass these fake .zip files and silent this unzip error ?

asked Mar 27, 2014 at 13:04

Hugolpz's user avatar

HugolpzHugolpz

17.1k26 gold badges98 silver badges185 bronze badges

4

Core solution

Using bash, you can just loop over the zip files instead of using a glob. This allows to prevent the Argument list too long error for rm, cp, mv commands and continue even if one file fail.

dir="/path/to/zip-dir"
cd "$dir"

for zf in *.zip
do
  unzip "$zf"
done

Testing before doing

You can add an extra test, in the for loop, to check if the file exists and has a size greater than zero before unzipping:

if [[ -s "$zf" ]];
then
  unzip "$zf" # greater exist & size>0
else
  printf "file doesn't exists or null-size: %sn" "$zf"
fi

a shorter version will be: [[ -s "$zf" ]] && unzip "$zf" (unzip only if exists and >0).

Reference

  • see man bash (look for -s or CONDITIONAL EXPRESSIONS section).
  • Question Argument list too long error for rm, cp, mv commands

Community's user avatar

answered Mar 27, 2014 at 21:26

Édouard Lopez's user avatar

Édouard LopezÉdouard Lopez

39.7k27 gold badges125 silver badges176 bronze badges

Option 1: use it with care — http://www.manpagez.com/man/1/unzip/

unzip -fo *.zip

Option 2: This may not work, it works for .gz extension.

tar -zxvf test123.tar.gz

z -- unzip
x -- extract the file
v -- verbose
f -- forcefully done

answered Mar 27, 2014 at 14:10

Ronak Patel's user avatar

Ronak PatelRonak Patel

3,7991 gold badge16 silver badges29 bronze badges

0

Reading time: 5 Minutes

Macs usually come with a built-in compression tool called the Archive Utility that zips and unzips files. However, because this tool has relatively basic functionalities, other Mac users opt to use third-party apps. A quick check at the Mac App Store even shows over 50 apps that can be used for zipping and unzipping files.

But what is a zip file by the way?

What is a Zip File?

An archive file format, a Zip file is a collection of one or more files/folders that are compressed into one file for easier transfer and compression purposes. Despite it being a popular file format, many macOS users have reportedly encountered problems with it. According to them, they cannot unzip files in Mac because of the Unzip Error 22: Invalid Argument error message.

Now, before we discuss why the unzip error 22 happens in Macs and how to fix the unzip error 22: invalid argument issue, allow us to discuss everything you need to know about macOS file compression for you to better understand the process.

macOS File Compression

Don’t bother looking for the Archive Utility in the Applications folder because you can’t find it there. Apple intentionally hid it because it’s a core service of the operating system. And when you say core service, it is used by Apple and macOS app developers to enhance the capabilities and features of an application. For instance, Mac Mail uses the Archive Utility to compress and decompress mail attachments. Safari, on the other hand, uses it to decompress downloaded files.

What’s great about this utility is that you can use it without having to launch it. But if you have a number of files to compress and decompress, you can conveniently open it, and then drag and drop files to it. You can access it by going to System > Library > Core Services > Applications.

Zipping a File/Folder

Compressing a file/folder is a relatively easy process. Simply follow the steps below:

  1. Open the Finder utility.
  2. Find the file or folder that you want to compress.
  3. Right-click on it and choose Compress from the list of options that appear.
  4. You will know if you have successfully compressed the file if you see a new file with the name of the item next to the word The new item should be named Compress [Item Name].

During the compression process, the selected file/folder is compressed. But the original file/folder is left intact. The compressed file/folder version will be stored in the same folder as the original file and will have a .zip file extension.

Zipping Multiple Files/Folders

Compressing multiple files/folders on your Mac is similar to compressing a single file/folder. The only noticeable difference is the name of the zip file generated.

To zip multiple files/folders on your Mac, here’s what you should do:

  1. Go to the folder that contains the folders/files you want to compress.
  2. Select all the items you want to compress. Shift + Click to select a range of folders or files. CMD + Click to select non-adjacent items.
  3. Once you have made a selection, right-click on any of the items and choose Compress.
  4. At this point, you already have a zipped file ready. It should have the word Compress in its file name, followed by the number of items selected and the file extension .zip.

Unzipping a File/Folder

Unzipping a file/folder is as easy as zipping one. Simply double-click on the zip file and it will automatically decompress in the same folder where the compressed file is stored.

If the item you decompressed contains more than one file, the decompressed item should retain the name of the original file. If a file with the same name already exists in the current folder, the decompressed file will have a number added to its name.

In case you didn’t know, there is another way to unzip a file/folder. It involves using Terminal, a built-in Mac program.

To use Terminal to unzip a file/folder, follow these steps:

  1. Open Use Spotlight to search for it.
  2. Into the text field, input unzip.
  3. Drag and drop the zip file into Terminal.
  4. Hit Enter and the file will be unzipped.

Why You Cannot Unzip Files

As perfect as this utility may seem, there are times when you can’t unzip files on your Mac because error messages like the Unzip Error 22: Invalid Argument pop up out of nowhere. Why do they happen? Here are a few reasons:

  • Corrupted File – If you downloaded the ZIP file in a browser, there is a chance that it becomes corrupted, especially if you have closed the website prior to the download completion. Even though the file is already in the Download folder, you simply cannot open and unzip the file.
  • Large File Content – Another possible reason why error messages appear while unzipping files on your Mac is that the file contains a large file.
  • Permissions – In some cases, file permissions keep you from unzipping files. To resolve this, you may have to use third-party software.
  • System Junk – Though rare, junk files may trigger the appearance of error messages associated with the Archive Utility.

How to Fix the Unzip Error 22: Invalid Argument Error

Are you looking for ways to resolve the Unzip Error 22: Invalid Argument error that appears while unzipping files on your Mac? If that is the case, then we cannot suggest a direct fix. What we recommend that you do is to try to unzip files using Terminal or simply perform a quick PC scan as junk and suspicious files might be keeping you from unzipping the files.

Unzip files using Terminal.

If double-clicking the file doesn’t work, you can try to unzip it using the Terminal utility. Perhaps, the file is too large that the decompress feature of the Archive Utility cannot handle it.

Don’t worry, though, because unzipping files in Terminal is easy. Just follow the steps below:

  1. Hold the CMD key and press Space to open Spotlight.
  2. Into the search bar, input Terminal and hit Enter.
  3. Unzip the file using the command: unzip filename.zip
  4. Press Enter and the file will be unzipped.

Perform a quick PC scan.

Still cannot unzip files? Try to perform a quick PC scan. It is possible that junk files are messing with important and core system processes, preventing you from executing or running utilities like Archive.

To perform a quick scan on your Mac, use a third-party Mac Repair tool like Mac repair app. Once the tool is downloaded and installed on your Mac, scan your system for any junk files and delete them. It should be easy-peasy!

Summary

Unzipping files on a Mac is easy as pie. All you need to do is double-click on the file and that’s it! The Archive Utility will take care of everything for you. However, if you fail to unzip files because of the Unzip Error 22: Invalid Argument issue, don’t panic. You can always try unzipping files using Terminal or just run a quick PC scan.

Do you know other ways to unzip files on a Mac? Share them below!

Give us some love and rate our post!




Vicrey Makapagal

Vic is a tech enthusiast who loves to be up-to-date with the latest and greatest technology in the world. He creates content that educates and helps users with their tech-related questions. Vic manages our website to ensure that our readers have a seamless experience while browsing. He excels in troubleshooting errors and resolving Windows issues for gaming and work purposes.

I have some *.zip files. I was trying to unzip these files through unzip command in Unix. But it is giving some trouble which I can not understand.

Here is what I am trying to do

unzip file.zip

It is giving the following error

bad CRC 64162f32  (should be b326db0b)

I have also tried some other way, which is

zcat file.zip > file.txt

and it is giving the following error

invalid compressed data--crc error

How should I solve this problem. Each *.zip file is almost 20GB in size.

asked Apr 11, 2016 at 5:11

Bionerd's user avatar

A CRC error means cyclic redundancy check, basically, a checksum of all files contained within the .zip file — this message is showing you that the checksum known the the .zip file, b326db0b, did not match the checksum that it just calculated while trying to extract the files, 64162f32.

This message is telling you that your .zip file is corrupt.

Were these files zipped locally? Or downloaded from a remote server? If transferred across the network, always do an md5sum on your files, and verify it against the server to verify you actually downloaded all the bytes you were supposed to.

answered Apr 11, 2016 at 5:16

Matt Clark's user avatar

Matt ClarkMatt Clark

2,0193 gold badges23 silver badges35 bronze badges

3

Проблема

При попытке разархивировать zip-файл появляется сообщение об ошибке unsupported compression method 99.

Решение

Метод сжатия 99 относится к шифрованию Adavanced Encryption Standard, которое не поддерживается программой unzip.

Однако вы можете использовать 7zip для распаковки защищенного паролем файла.

Выполните следующие действия:

# Установите полную версию 7zip.
sudo apt-get install p7zip-full
 
# Распакуйте свой файл.
7z  x  your-file.zip
 
# Или распакуйте защищенный паролем файл.
7z  x  -pPASSWORD  your-file.zip

см. также:

  • 🐧 Как установить Zip и Unzip на Linux
  • 🐧 Как использовать команду Unzip на Linux
  • Как использовать команду Linux gunzip с примерами
  • 🗃️ В чем разница между Tar и Gzip? Подробности с примером
  • 🐧 Как сжать весь каталог с помощью xz и tar в системах Linux
  • 🐧 Как заархивировать все файлы в каталоге в системах Linux?

LinuxunzipZIP

Понравилась статья? Поделить с друзьями:
  • Как найти площадь прямоугольника по заданным координатам
  • Как найти расстояние между двумя проводниками
  • Как найти сумму льгот
  • Как найти ява скрипт в браузере
  • Как найти плодовые почки