I need to replace all images in the product catalogue with larger images. The filenames are the same but Magento spread all images under some very nested directory structure like


Is there a way to tell Magento to flatten this directory stucture to one directory so that I can just bulk update all the images via FTP without having to work my way through the Magento admin one by one?


2 Answers 2


No there is no way to flatten the directory structure

Take a look at How to upload product images via FTP instead of using the Magento UI?

The structure is fairly simple. For product ABC1234, the images for that product would be placed in the

media/catalog/product/a/b/abc1234.jpg media/catalog/product/a/b/abc1234_t.jpg (etc).

The first folder in the product folder is the first character of the product number. The subfolder under that is the second character of the product number.

So for product DEF6789, the structure would be:


Assuming that there is some logic to your file and they have the same name as the existing image in magento then you could either

  1. Create a bash script to move them to the correct directory (assuming that the image name is also the product name)

  2. Create a script that load your product collection the programmatically update the product see Magento programmatically add product image

Be careful to make backups of your directory structure before running these scripts, as you can severely mess up your files if you are not knowledgeable and careful.


Use Magmi to do this. It will likely be faster and easier


  • You can set it to update existing products and give it the new images in a CSV format, which you can generate in Excel or a different spreadsheet program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.