Author Topic: How to add a tag to a ZIP file?  (Read 396 times)

biEnvEAm

  • Newbie
  • *
  • Posts: 1
How to add a tag to a ZIP file?
« 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: How to add a tag to a ZIP file?
« Reply #1 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: How to add a tag to a ZIP file?
« Reply #2 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.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: How to add a tag to a ZIP file?
« Reply #3 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: How to add a tag to a ZIP file?
« Reply #4 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.

Code: [Select]
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
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16703
    • ExifTool Home Page
Re: How to add a tag to a ZIP file?
« Reply #5 on: November 14, 2019, 01:19:25 PM »
Thanks.  I'll take a look at this when I get a chance.

- Phi
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: How to add a tag to a ZIP file?
« Reply #6 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.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.