You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

iPhone Photos in Windows Explorer: Workaround / Automation for Deleting Originals of Edited IMG_E Files

This is not a question but a SOLUTION.

Since there are already many topics about "IMG_E" files, but none of them can be answered anymore because they were closed by the community or system, I have to write a new one here.

It's about the duplicate pictures and videos that start with "IMG_E" instead of "IMG_". For example, IMG_E0023.HEIC, IMG_E0023.JPG, IMG_E0023.MOV, and there are also the "original" versions IMG_0023.HEIC, IMG_0023.JPG, IMG_0023.MOV.

I wrote a batch script for the Windows command line that searches for the "E" files and checks if there is an original version. If there is, the "E" file will be deleted.


PLEASE TRY IT FIRST WITH A COPY OF A SMALL GROUPE OF FOLDERS THAT YOU WANT TO PROCESS BEFORE APPLYING IT TO YOUR WHOLE PICTURE COLLECTION.


delete_all_E_duplicates_of_IMG_xxxx.bat


batch
Copy code
@echo off
setlocal enabledelayedexpansion

rem Start the search in the current directory (or specify a path)
for /r %%d in (.) do (
    rem Search for all IMG_E*.MOV files
    for %%e in ("%%d\IMG_E*.MOV") do (
        rem Create the name of the corresponding original file IMG_*.MOV
        set "original=%%~dpne.MOV"
        set "edited=%%e"
        
        rem Check if the original file exists
        if exist "!original!" (
            rem If the original file exists, delete the edited MOV file
            echo Deleting !edited!
            del /q "!edited!"
        )
    )
    
    rem Search for all IMG_E*.HEIC files
    for %%e in ("%%d\IMG_E*.HEIC") do (
        rem Create the name of the corresponding original file IMG_*.HEIC
        set "original=%%~dpne.HEIC"
        set "edited=%%e"
        
        rem Check if the original file exists
        if exist "!original!" (
            rem If the original file exists, delete the edited HEIC file
            echo Deleting !edited!
            del /q "!edited!"
        )
    )
    
    rem Search for all IMG_E*.JPG files
    for %%e in ("%%d\IMG_E*.JPG") do (
        rem Create the name of the corresponding original file IMG_*.JPG
        set "original=%%~dpne.JPG"
        set "edited=%%e"
        
        rem Check if the original file exists
        if exist "!original!" (
            rem If the original file exists, delete the edited JPG file
            echo Deleting !edited!
            del /q "!edited!"
        )
    )
)
endlocal


iPhone 15 Pro

Posted on Oct 20, 2024 8:28 AM

Reply

There are no replies.

iPhone Photos in Windows Explorer: Workaround / Automation for Deleting Originals of Edited IMG_E Files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.