On my Magento 1.9 website I duplicate the most recently added configurable product when I need to create a new one because most of the details are the same (because it's a t-shirt website). I've now got to the point where I receive the following error:
Failed to copy file /home/userdirectory/public_html/media/catalog/product/z/_/z_m528_st_leads_dark-heather-grey_2_6_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_2_1_1_1_1_1_1_1_1_2_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_2_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1_3.jp. Please, delete media with non-existing images and try again.
Every time I've been duplicating, it's been appending _1 or _2 to the image name and now the file names have got too long. Is this normal Magento behaviour? Is there a way I can prevent these and remove all of these duplicate files? Surely if I'm duplicating a product it should point the image to the same, original file and not leave duplicate copies on my server?
Hey Liam,
It is normal Magento behavior to append a _1 when a image gets duplicated. I've never seen a _2 or _3 before but that could be valid as well.
I've never seen someone duplicate it so much that you hit this limit (nothing wrong with it). I would just recommend to rename it to another name.
I'll see if I can find the code that does this rename.
Hi Kris,
Because the images are used for product swatches, I can't rename them (because they have to match the image label), for example, grey.jpg.
I guess I'll have to see if I can write a script to point them all back to the original file name and then remove the unused images from the server.
Thanks,
Liam