I'm suffering a version of this, too.
I've got a list of about a hundred folders, and I added comments to the folders via the "Spotlight Comments" space. But they don't survive long. Well, to be more precise, a bunch of them don't survive long. The first dozen or so are there, but all the others evaporate into nothingness.
In the terminal, do this on a file that you know had/has a comment (that doesn't show with Command-I) :
$ mdls /path/to/somefile | grep Comment
And you should get this:
kMDItemFinderComment = "SOME COMMENT"
$ mdimport -n /path/to/somefile
and now the comment should reappear in the finder
I'm not sure why this works. Perhaps someone could come up with a way to automate the process to get them all back.
I'm not adept enough to get these Terminal commands just right. Even copying the path just so apparently escapes me, as my attempts in Terminal to execute this procedure results in error messages.
If someone could either walk me through this (how to copy the path of the file accurately, how to edit command line in Terminal), or come up with a more automated way of doing this, I would run right out and buy a large bag of fun-size Milky Way bars and eat them. I mean, send them to this person in gratitude.
OK. The easiest way is to use the TAB key to automatically expand the file path or to use quotes
Click on the file you want and do Command-I to see its path.
You can do a couple of things:
$ cd "/Users/rshs/Documents/" (you can copy straight out of the Get Info; cd = change directory)
$ mdls M [hit the TAB key so that it expands] etc.
Or you can just do it from the beginning using the TAB key
$ mdls /Us[TAB]r[TAB]d[TAB]
Don't type the $,
You'll see what I mean about the tab when you try it.
If your file name has a space, you'll need to do \ then a space, but usually the TAB key will take care of it anyway. If you get a beep, you need to type a couple of extra letters:
c[TAB] won't do anything but ca[TAB] will expand to cat
You can TAB to expand the commands such as
but you'll usually need to type the first 2 or 3 letters.
when I do this process with a file on my Mac's hard drive, it works fine, but spotlight comments still don't show up in the comments window of the file. I do however see them within terminal.
when I do this process on a file on my external hard drive it says it can't file the file but I'm dragging the file into the terminal so I know the path is correct.