Author Topic: Challenge: force writing metadata to file without extension  (Read 371 times)

bmn

  • Full Member
  • ***
  • Posts: 32
Challenge: force writing metadata to file without extension
« on: March 01, 2019, 02:00:25 PM »
I have some zip files without extension (which gets generated only after the download) and I'm trying to write some metadata to them.

I know Exiftool supports only READ for zip files, not WRITE (which means I could only read metatags from this extension), but here's what I'm trying to accomplish:

Being the file without extension, I'd like ExifTool to ignore the file type (I tried -fast4 for the moment, but didn't seem to work, unless the tag I'm trying to write isn't correct), and then, I'd like to rename this zip file to another file type which supports read/write (such as PNG or JPEG for example), just to read the custom metadata I wrote.


Example:

File to process:  t1e2s3t4
Meta data field to write: "CreationTime"
Meta Tag to add: "2019-01-03 00:00:00"


So, I'd run the command:


Code: [Select]
exiftool -overwrite_original '-CreationTime=2019-01-03 00:00:00' t1e2s3t4

Now, if this was a PNG file, it'd work fine, as the Creation Time would be actually set to that, while if the file is a zip file, it doesn't work, and renaming its extension to .png (just to access the Creation Time field in the file details, that field is empty.


So I tried making it a bit more "brute" by editing it this way:

Code: [Select]
exiftool -f -fast4 -m -overwrite_original '-CreationTime=2019-01-03 00:00:00' t1e2s3t4
So that I force it, I make it ignore errors and I make it ignore the file header, but still, the meta tag doesn't get added.

Is there any workaround for this?


Thank you so much :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: Challenge: force writing metadata to file without extension
« Reply #1 on: March 01, 2019, 02:08:22 PM »
Being the file without extension, I'd like ExifTool to ignore the file type

If you specify a file on the command line it will only be ignored if you specify one or more -ext options for file extension(s) you want to process.

There is currently no way to get ExifTool to write metadata to a zip file.

- 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 ($).

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #2 on: March 01, 2019, 02:14:56 PM »
Thank you for your fast reply, I appreciate it :)

Hope in the future there will be a way to accomplish my goal!

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2368
Re: Challenge: force writing metadata to file without extension
« Reply #3 on: March 01, 2019, 02:22:43 PM »
Just to double check, are you sure that the value you want to write isn't actually the FileCreateDate?  That is a system tag and exiftool can write that for a zip file.
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.

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #4 on: March 01, 2019, 03:01:02 PM »
Thank you for your reply and your suggestion! I wasn't aware of the fact "FileCreateDate" could be used for zip files, however, when I tried:

Code: [Select]
exiftool -overwrite_original '-FileCreateDate=1974-04-26 00:00:00' my_test_file
the creation date of the file didn't change.

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #5 on: March 01, 2019, 03:19:03 PM »
Ok, turns out maybe I'm wrong. It looks like this meta data field isn't shown in windows file details tab, that's why I didn't notice it, so I guess I should find a way to see all the metadata of a file with Windows in order to confirm it works properly or not :)

So far, as per my checks, even using some online tools which extract all the file's metadata, I still can't find the file creation date meta tag for zip files.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2368
Re: Challenge: force writing metadata to file without extension
« Reply #6 on: March 01, 2019, 04:37:22 PM »
The question is what are you using to see a creation date?

My quick google search doesn't show anything to indicate that zip files contain an embedded time stamp as to when they were created.  There's a Modify Date and there's the creation date of the various files archived, but I see nothing indicating a create date using 7zip and WinRar.
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.

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #7 on: March 01, 2019, 04:50:24 PM »
Thanks again for your fast reply StarGeek.

At this point I'm confused, which Metadata of a zip file can I create or edit using ExifTools?

A previous reply said:
There is currently no way to get ExifTool to write metadata to a zip file.

But I guess it's not entirely true then as some Metadata could be written to a zip? If so, which fields can be written or edited?

From the documentation I found, zip files Metadata can only be Read, but not Written, am I wrong then? (don't get me wrong, I truly hope I'm wrong)

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2368
Re: Challenge: force writing metadata to file without extension
« Reply #8 on: March 01, 2019, 05:03:52 PM »
Exiftool cannot write any embedded metadata for a zip file (See Zip Tag Names).  But it can write some File System data, such as the file system time stamps or permissions (see the file or system type tags under Extra Tags).  These are properties of any file that is on the disk and not specific to ZIP files.

Take note that embedded metadata is specific to the type of file.  You cannot, for example, write Caption-Abstract (a image specific tag) to a .MP4 or other video file. CreationTime, as you mention in your first post, is limited to PNG files and DICOM files.  You cannot just add it to other file types that don't support 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.

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #9 on: March 02, 2019, 06:24:24 PM »
Thank you. Could you please explain me why FileCreateDate didn't work as per my previous post? Being a system tag it should've been able to alter my zip file's Metadata, but for some reasons, it didn't.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2368
Re: Challenge: force writing metadata to file without extension
« Reply #10 on: March 02, 2019, 07:04:15 PM »
If you're on Windows, you need to use double quotes.
exiftool -overwrite_original "-FileCreateDate=1974-04-26 00:00:00" my_test_file

Another thing to take note of is that when you're setting creation dates to early dates like this, the Perl date/time lib that exiftool uses has problems.  If you set the time to a date between 1900:01:01 00:00:00 and 1968:12:31 23:59:59, the year will be inaccurate.
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: 14425
    • ExifTool Home Page
Re: Challenge: force writing metadata to file without extension
« Reply #11 on: March 03, 2019, 09:25:36 AM »
@bmn: I don't think you yet grasp the concept or terminology involved.  The ExifTool FileCreateDate is not metadata in the zip file.  Just as the name of the Directory containing the zip file is not metadata in the zip file.  But ExifTool will report this filesystem information when you extract metadata from the file, and will allow you to write it in the same way as writing metadata tags, but there is a a real difference.  See the second paragraph here.

- 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 ($).

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #12 on: March 04, 2019, 03:58:11 AM »
If you're on Windows, you need to use double quotes.
exiftool -overwrite_original "-FileCreateDate=1974-04-26 00:00:00" my_test_file

Another thing to take note of is that when you're setting creation dates to early dates like this, the Perl date/time lib that exiftool uses has problems.  If you set the time to a date between 1900:01:01 00:00:00 and 1968:12:31 23:59:59, the year will be inaccurate.

Sorry, I didn't specify it, I guess I should try to specify more in depth what I'm trying to do.

• I'm downloading the file thru my Linux server, appending the following php script into the download script:

shell_exec("exiftool -overwrite_original '-FileCreateDate=1974-04-26 00:00:00' my_test_file");

• I then installed exiftool on my windows pc, so I dragged this file onto the executable in order to open a cmd window which shows all the metadata of the file, but I can't find any 1974-04-26 (or any other dates I set)

Exiftool normally works fine if I edit the metadata of png or jpeg files and so on, but with ZIP files I'm having troubles to find out what I can do in order to add any piece of metadata before downloading the file which I can later read after I downloaded the file.

In the meantime, let me thank you for the amazing support you guys give to newbies like me, all the forums should learn from the way you deal with users.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: Challenge: force writing metadata to file without extension
« Reply #13 on: March 04, 2019, 07:07:47 AM »
Quote
• I'm downloading the file thru my Linux server, appending the following php script into the download script:

shell_exec("exiftool -overwrite_original '-FileCreateDate=1974-04-26 00:00:00' my_test_file");

On Linux there is no filesystem creation date/time, so FileCreateDate cannot be set by ExifTool on these systems.

Quote
with ZIP files I'm having troubles to find out what I can do in order to add any piece of metadata before downloading the file which I can later read after I downloaded the file.

Please try to understand my last post.

- 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 ($).

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #14 on: March 04, 2019, 07:12:12 AM »
From what I understand there's no way with my setup to set an extra tag (which is the only writeable tag) into a zip file using Linux which I can later see on a Windows platform then, right?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14425
    • ExifTool Home Page
Re: Challenge: force writing metadata to file without extension
« Reply #15 on: March 04, 2019, 07:21:44 AM »
Yes.
...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 ($).

bmn

  • Full Member
  • ***
  • Posts: 32
Re: Challenge: force writing metadata to file without extension
« Reply #16 on: March 05, 2019, 01:32:53 PM »
Thanks for your patience Phil.