2

Purpose: zip a folder in window and extract it in linux.

I prefer to https://superuser.com/a/898508/1451256 and I realize there is no description for -a option in tar.exe --help: https://ss64.com/nt/tar.html , so I just follow as the tar official: "tar -cvzf xxx" but when I've tried to extract that zip file in linux by "unzip xxx", it throws error " End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. "

So I suspect the zip file is not zipped properly, then I try to add -a option, it works perfectly. As comment from https://superuser.com/a/1473257/1451256 : it says without the -a option "it assumes a plain tar archive", I don't know what it means. Can someone explains what is the -a option? Thanks.

1 Answers1

2

tar(1):

...
-a, --auto-compress
             (c mode only) Use the archive suffix to decide a set of the
             format and the compressions.  As a simple example,
                   tar -a -cf archive.tgz source.c source.h
             creates a new archive with restricted pax format and gzip
             compression,
                   tar -a -cf archive.tar.bz2.uu source.c source.h
             creates a new archive with restricted pax format and bzip2
             compression and uuencode compression,
                   tar -a -cf archive.zip source.c source.h
             creates a new archive with zip format,
                   tar -a -jcf archive.tgz source.c source.h
             ignores the "-j" option, and creates a new archive with
             restricted pax format and gzip compression,
                   tar -a -jcf archive.xxx source.c source.h
             if it is unknown suffix or no suffix, creates a new archive with
             restricted pax format and bzip2 compression.
...
Tom Yan
  • 10,996