Not sure if this makes sense but I'm trying to attach hotlinked images to their posts/pages with no lucky, most plugins such Cache images works ok but only to external domains, I need to auto-attach hotlinked images in the same domain/server.

Thanks Toscho, but images aren't in Media Library :(, they are in thousand folders around the same server/domain. This happened duo copying-pasting content from static html files into WP pages.
–
DianaJan 4 '13 at 21:12

Thanks @toscho, I think I figured how your code can work (that can take time hahah), firstly import images files within server (Add form server plugin can do this or can use a custom script), find image paths within every post/page that match filenames now in media library, then attach them.

I can't use this because there where different imagens but same filenames along different folders (also some problems with filenames using spaces), then I had to use this plugin, you must visit/edit every page/post and download the images, that can be a pain but at least will work with files wherever they are (same doamin for example), surely there is someway to hack this plugin to work on every post on page.

(If image filenames has spaces this plugin still will return empty images and you need to re-edit it manually, don't know why WP can diplay hotlinked images with strange filenames)