ExifTool Forum

ExifTool => Newbies => Topic started by: biEnvEAm on November 14, 2019, 07:36:53 AM

Title: How to add a tag to a ZIP file?
Post by: biEnvEAm on November 14, 2019, 07:36:53 AM
Hi guys,
I'm looking to add a certain piece of information to a ZIP file, a string, in example:

tag name: acm_version
tag value: 4.1.0.23

I understand that ExifTool can't write ZIP tags (ZipBitFlag, ZipCompressedSize, etc') but I take it ExifTool can write other types of tags on a ZIP file, is that correct? will that let me add this information to a ZIP file?

Thanks
Title: Re: How to add a tag to a ZIP file?
Post by: Phil Harvey on November 14, 2019, 07:49:50 AM
I think the thing to do would be create an XMP file containing the metadata you want (maybe with a name "_metadata.xmp" or something like that), and add it to the ZIP file.  You can use ExifTool to create the XMP file, and any zip app to add it to the archive.

- Phil
Title: Re: How to add a tag to a ZIP file?
Post by: StarGeek on November 14, 2019, 11:42:28 AM
All the tags exiftool shows for a zip file are actually properties of the file in the same way that an image file has an image size and video files have a duration.  They're not things that can be edited without fundamentally changing the file itself.

Now, zip files do allow for comments to be added to a zip file, though exiftool doesn't display these.  Using WinRar you can add a comment to the whole file.  You access it under Commands menu->Add Archive Comment or hit Alt-M.

7Zip does it differently.  It allows you to add a comment to each individual file in the archive, but it does it by creating a file called "descript.ion" in the archive.
Title: Re: How to add a tag to a ZIP file?
Post by: Phil Harvey on November 14, 2019, 12:08:08 PM
Hi StarGeek,

Could you send me a small zip file with a comment added?  I would like to look into this.

- Phil
Title: Re: How to add a tag to a ZIP file?
Post by: StarGeek on November 14, 2019, 12:48:16 PM
Here is a zip file and a rar file and example output from 7zip that shows the comments.

7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30

Scanning the drive for archives:
1 file, 191 bytes (1 KiB)

Listing archive: C:\text.zip

--
Path = C:\text.zip
Type = zip
Physical Size = 191
Comment = This is a ZIP comment.

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2019-11-14 09:31:11 ....A           19           19  text.txt
------------------- ----- ------------ ------------  ------------------------
2019-11-14 09:31:11                 19           19  1 files


7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30

Scanning the drive for archives:
1 file, 136 bytes (1 KiB)

Listing archive: C:\text.rar

--
Path = C:\text.rar
Type = Rar5
Physical Size = 136
Solid = -
Blocks = 1
Encrypted = -
Multivolume = -
Volumes = 1
Comment = This is a RAR comment.

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2019-11-14 09:31:11 ....A           19           19  text.txt
------------------- ----- ------------ ------------  ------------------------
2019-11-14 09:31:11                 19           19  1 files
Title: Re: How to add a tag to a ZIP file?
Post by: Phil Harvey on November 14, 2019, 01:19:25 PM
Thanks.  I'll take a look at this when I get a chance.

- Phi
Title: Re: How to add a tag to a ZIP file?
Post by: StarGeek on November 14, 2019, 01:47:10 PM
It's not used very often.  While 7zip can read the comments, it doesn't have the ability to write it.