Challenge: force writing metadata to file without extension

Started by bmn, March 01, 2019, 02:00:25 PM

Previous topic - Next topic

bmn

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:


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:

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

Quote from: bmn on March 01, 2019, 02:00:25 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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bmn

Thank you for your fast reply, I appreciate it :)

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

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

bmn

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:

exiftool -overwrite_original '-FileCreateDate=1974-04-26 00:00:00' my_test_file

the creation date of the file didn't change.

bmn

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

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

bmn

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

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

bmn

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

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

@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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bmn

Quote from: StarGeek 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.

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

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.

Quotewith 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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bmn

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

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

bmn