wp_delete_attachment()
is very comprehensive and wipes every trace of attachment from database and disk.
Is there easy way to keep original file? Forking under another name is not an option, because other functions like wp_delete_post()
will still call original version.
Year and some later with much improved skills, behold:
Assuming
$attachment_id
is the ID of the attachment you want to delete without deleting the file, this should do it: