Title: Overwrite existing image
Last modified: August 26, 2018

---

# Overwrite existing image

 *  Resolved [Lovro Hrust](https://wordpress.org/support/users/lovor/)
 * (@lovor)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/overwrite-existing-image/)
 * Hello, I have an issue with renaming where some of the pictures already exist
   in a directory (although not part of wordpress Media library). Such weird situation
   is a result of optimizer plugin, which keeps original file and renames optimized
   images by adding prefix. Media file renamer skips renaming pictures where file
   already exist. I would prefer if the plugin asked for confirmation for overwriting
   or simpler, overwrite without asking. I am also capable to add this option to
   plugin myself. Would you prefer to do it yourself, or would you like if I added
   this option as contributor?
 * Best, L.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Foverwrite-existing-image%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/overwrite-existing-image/#post-10626701)
 * Hi,
 * Overwriting can’t be an option: it might be a (big) mistake to do so most of 
   the time. Adding a modal asking for overwriting would also be quite some work,
   for a feature that was also never asked (and even more difficult in the bulk 
   process, that is usually run overnight and shouldn’t have any popups).
 * You can add this option for yourself, but I am not sure it would be good to have
   this in the native plugin, or maybe I missed the point? 🙂
 * I worked with a lot of optimizer plugin but I am not sure why it would be a problem
   to keep the original file somewhere and to work with different names files, Renamer
   has always worked with EWWW for example, that does that.
 *  Thread Starter [Lovro Hrust](https://wordpress.org/support/users/lovor/)
 * (@lovor)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/overwrite-existing-image/#post-10630296)
 * Hi,
    thanks for the answer. Perhaps I am the only one with this need? The problem
   with optimizing plugin is, while it keeps original file intact, it renames the
   optimized image files by adding prefix before the filename. Apparently, this 
   is not good for the SEO, and my client wants the image file names without prefixes.
 * Perhaps overwriting is not an good idea, but maybe renaming original file before
   the renaming process starts is an better one? If rename process fails without
   a message to the user why, like it does now, is also not an good idea 🙂
 * I just discovered by looking at your code that output should be placed at log
   file media-file-renamer.log in plugins directory. However, there is no such file
   created in my case. I also discovered there should be a message in the log file
   if renaming fails due to already existing filename: “The new file already exists(
   $new_filepath). It is not a case issue. Renaming cancelled.”
 * I also discovered there is a filter “mfrh_force_rename” that should forcefully
   rename even if the file exists. This could solve my problem.
 * I am still wondering why logging does not work.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Overwrite existing image’ is closed to new replies.

 * ![](https://ps.w.org/media-file-renamer/assets/icon-256x256.png?rev=2791577)
 * [Media File Renamer: Rename for better SEO (AI-Powered)](https://wordpress.org/plugins/media-file-renamer/)
 * [Support Threads](https://wordpress.org/support/plugin/media-file-renamer/)
 * [Active Topics](https://wordpress.org/support/plugin/media-file-renamer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-file-renamer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-file-renamer/reviews/)

## Tags

 * [overwrite](https://wordpress.org/support/topic-tag/overwrite/)

 * 2 replies
 * 2 participants
 * Last reply from: [Lovro Hrust](https://wordpress.org/support/users/lovor/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/overwrite-existing-image/#post-10630296)
 * Status: resolved