0

I have many catalogs where one folder contains photos in .jpg format and the second folder having same filenames in .dng format. There are some missing files between these two folders. My objective is to find the difference. In the end, I'm gonna delete 'extra' files from the folder with more files. I was trying to use winmerge but without a success.

4
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Apr 27, 2023 at 19:14
  • Do you mean .png?
    – Gantendo
    Apr 27, 2023 at 19:46
  • Next time explain how exactly you failed with the app that you used, instead of just "without a success", please. I'm pretty sure it's not too hard to achieve with WinMerge either (or maybe not now that I'm looking) but didn't have that installed on this machine
    – Destroy666
    Apr 27, 2023 at 20:03
  • @Destroy666 To be honest - I'm not familliar with Winmerge. I looked at default filters and also did a research. Many years ago someone had similar issue: superuser.com/questions/585503/…
    – Adam
    Apr 29, 2023 at 19:55

2 Answers 2

0

You could use a simple PowerShell script like this:

# Get all dngs/jpgs and their base names and extensions to arrays of objects
# Change testdirs to relative/absolute paths
$jpgs = Get-ChildItem -Path testdir1 -Filter "*.jpg" | Select BaseName, Extension
$dngs = Get-ChildItem -Path testdir2 -Filter "*.dng" | Select BaseName, Extension

# Compare arrays by base name and output the table of differences
Compare-Object -ReferenceObject $jpgs -DifferenceObject $dngs -Property BaseName -PassThru

Example result:

BaseName Extension SideIndicator
-------- --------- -------------
onlydng  .dng      =>
onlyjpg  .jpg      <=
test     .jpg      <=
2
  • Works excellently, thanks! :) have you any idea how to simply remove (move to trash) files from this list/part of it?
    – Adam
    May 2, 2023 at 13:25
  • @Adam no problem, the 2nd part isn't part of the initial question though, it's also unrelated. This isn't a discussion forum, questions should be focused here. Look at Remove-Item PowerShell function and piping and ask a new question if you fail, although that's a rather basic task.
    – Destroy666
    May 2, 2023 at 13:29
0

This .bat file when run inside the folder with the jpg files will find which dng files do not exist:

@echo off
setlocal enabledelayedexpansion
for /r %%f in (*.*) do (
    set fname=%%~nf
    set "newname=c:\folder-of-dng-files\!fname!.dng"
    if not exist "!newname!" echo !newname!
)

Modify the script as necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .