tar

Cannot open Zip file after creation with tar.exe


I'm trying to use Tar.exe in a Windows 10 command prompt to zip an entire folder and its subdirectories into a .zip file.

After reading different answers on here and this online help, so far I have the following:

tar.exe -cvzf "C:\Users\Me\Desktop\Output.zip" "C:\Users\Me\Desktop\MyFolder"

This appears to work within the command prompt (no errors and all files get listed). The .zip file gets created on the Desktop but when I try to open it by double-clicking on it, I get this error:

Windows cannot open the folder.

The Compressed (zipped) Folder 'C:\Users\Me\Desktop\MyFolder' is invalid.

I dragged the file into Notepad to see if there were any headers that might uncover the problem, but it looks like some kind of oriental affair...!

enter image description here

Can anyone advise what I've done wrong here please?


Solution

  • After much deliberation, I finally opted to use 7-Zip:

    "C:\Program Files\7-Zip\7z.exe" a -tzip "C:\Users\Me\Desktop\MyFolder.zip" "C:\Users\Me\Desktop\MyFolder" 
    

    The destination machine without 7-Zip could still read the file, but more importantly, the speed of the zip creation was magnitudes faster than Windows's UI or the Tar function.