Writing AppleScript to change a TextEdit document from .rtfd file to .rtf
The @user3439894 comment provides a better solution but since this is tagged as applescript, here is an applescript answer.

Will prompt user to choose one or more rtfd, copy them to the desktop, turn them into actual folders, extract each one's text/rtf component to the desktop, and trash the unwanted bits. I don't know how you actually get the target files so I went with 'choose' and stuck to using the desktop as the workplace.

use scripting additions
-- Choose one or more rtfd
set aFilList to {}
set aFilList to (choose file with multiple selections allowed)
tell application "Finder"

    repeat with aFil in aFilList

        -- copy rtfd to desktop; collect name information       
        set dFil to duplicate aFil to (path to desktop folder)
        set {adNam, ddNam, dwXt} to {displayed name of aFil, displayed name of dFil, ".rtf"}
        --&gt; {"filename", "filename 2", ".rtf"}, or {"filename", "filename copy", ".rtf"}

        -- Remove 'd' from extension to reveal as type:folder
        set name of dFil to ddNam &amp; dwXt
        set dFil to ((path to desktop) &amp; ddNam &amp; dwXt as text)

        -- Move rtf to desktop and rename; trash intermediary files
        move file "TXT.rtf" of alias dFil to (path to desktop) with replacing
        set oFil to (path to desktop) &amp; "TXT.rtf" as text
        set name of alias oFil to (adNam &amp; dwXt)
        delete aFil
        delete dFil

    end repeat
end tell