windowsbatch-fileexplorerphotos

Fastest way to delete difference of Files with same name, but different filename extension in Windows


The scenario:

I have thousands of pictures (Both in .jpg and RAW), where each pair has the same name. I have looked through the JPGs and deleted hundreds of undesirable photos. Now I want the corresponding RAWs (The ones without "partner") deleted.

Everything is allowed: cmd, Windows Powershell, Scripts, hidden functions in Windows Explorer, ...


Solution

  • Speed is absolutely unimportant, you could have opened Windows Explorer, sorted by name highlighted all instances and deleted them in the time it took you to post this message and wait for an answer to your off-topic question.

    Open a Command prompt window, (cmd.exe), CD to your directory holding these files; then enter this:

    For %A In (*.RAW) Do @If Not Exist "%~nA.jpg" Del "%A"