2

I have a bunch of old files in FLV format, which VLC will convert to M4V format while preserving the audio and video tracks (not re-encoding them). Many of them have Finder comments that I want to copy to the new files, appending a note that it's converted.

I see that running:

mdls -raw -name kMDItemFinderComment "$f"

in bash will read the comments, but bash appears to have some trouble with non-ASCII characters. I've tried xattr and an osascript command to apply the comment to the new file, but both are choking on the special characters (mostly bullet: ).

I even tinkered with making an AppleScript droplet to do it, but that's a mess too…

Any advice?

1

This AppleScript code works for me using the latest version of macOS Mojave.

set originalFile to (path to desktop as text) & "Original.flv"
set convertedFile to (path to desktop as text) & "Converted.m4v"

set appendTextToComment to " This File Has Been Converted"

tell application "Finder"
    set originalComment to comment of alias originalFile
    set comment of alias convertedFile to originalComment & appendTextToComment
end tell

Obviously you need to change the file path variables to the location of your files and the appended text value to whatever you want

|improve this answer|||||
  • I'm using on open these_items, and repeating over the items (which are aliases), but your code was easily adapted. Thanks. – Jerry B Mar 30 '19 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .