Extract attachments from RTFD files?

Is there a way to extract attachments from an RTFD file in DT? I have a ton of notes from Bear that were exported long ago as RTF with attachments, and I’m trying to find out how to extract attachments from selected notes to the same directory as the originating file.

Right now, I’m opening the file in Finder, viewing the package contents, and dragging the files back into DT. There must be a better way.

Any help would be much appreciated. Thanks.

You can drag and drop attachments out of an RTFD file directly in DEVONthink.

Thanks, that’s a handy tip for individual files, but for bigger jobs, if anyone has made a script for handling multiple files in a single document, please do share.

Isn’t an RTFD basically a folder containing the relevant files (included the RTF document)? If so, a script could be trivial to write (access the RTFD’s path property and loop over all files in that folder, excluding the RTF file).

This was discussed here Script: Split RTF(D) records (preserving images and attachments) - #5 by Silverstone
I haven’t tested the solution

That’s the code for my prose – a simple one-liner. Thanks for finding that.