macOS Finder comments vs. kMDItemComment

A place to find NeoFinder support questions and answers
Post Reply
Macpingel
Posts: 2
Joined: Fri Jun 23, 2023 9:41 am

macOS Finder comments vs. kMDItemComment

Post by Macpingel »

Hi there,

I happily use NeoFinder to keep track of my video collection of .mp4 files. Until now, I used Finder-comments to store a short description of content, and cataloged this with NeoFinder.

I recently learned to my horror that Finder-comments are stored in the .DS_Store file of directories, and not connected to the original file (according to this article). https://eclecticlight.co/2020/11/06/fin ... -avoiding/

The article mentions a metadata field for files named kMDItemComment. This metadata seems to be affixed to the file, and will travel across disks.

I tried to catalog this field with NeoFinder, but haven't found a way. Can this metadata field be cataloged?

I could of course use MP4 Tags, but that would mean to alter 20 TB of files, and the backups of 20 TB of files, while a change in metadata would be just directory information to be altered. Also, MP4 Tags are not shown in Finder. But they are perfectly read by NeoFinder ;-)
neo-admin
Site Admin
Posts: 188
Joined: Tue Mar 08, 2022 3:10 pm

Re: macOS Finder comments vs. kMDItemComment

Post by neo-admin »

NeoFinder can catalog Finder Comments, but most unfortunate, Apple has never provided an official API for that important task.

We had opened an official bug report for that back in 2013, but it has been simply ignored by Apple so far.

By default, NeoFinder first tries to read the xattr that store Finder comments, and then falls back to it tries to read the kMDItemComment. Most unfortunately, the Spotlight database for remote volumes often doesn't even contain that information, so NeoFinder can also fall back to using AppleScript to ask the Finder, which most often works, but is very slow.

You can use this Terminal command to force NeoFinder to use AppleScript for that:

defaults write de.wfs-apps.neofinder tryAppleScriptForComments YES

Please also file a bug with Apple, asking for a suitable developer API to read and write these Finder comments. The more the merrier.
Macpingel
Posts: 2
Joined: Fri Jun 23, 2023 9:41 am

Re: macOS Finder comments vs. kMDItemComment

Post by Macpingel »

Thank you for the thorough answer, but I am not sure I understand fully. For a file there are three places to store comments:

- .DS_Store in enclosing directory

- com.apple.metadata:kMDItemFinderComment attribute in a files metadata, "somehow" connected to finder comments in .DS_Store. Could be used to restore a lost .DS_Store file.

- com.apple.metadata:kMDItemComment attribute in a files metadata, and (according to the mentioned article) quite persistent in traveling with the file. This one is shown in Finder Info in "More Info/Weitere Informationen", but can't be changed by Finder.

My question was about the last of the three: Can com.apple.metadata:kMDItemComment be cataloged? I suppose your mentioned AppleScript reading was concerning only the first two? Because I tried it, and NeoFinder didn't catalog a comment in kMDItemComment (not Finder comment), which is visible in Finder on the indexing machine (the file itself is shared from another Mac via SMB).
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests