Compare two folders and output missing files in both folders
Solution 1
robocopy
(included in recent Windows versions) can do this in one pass:
given \source\
and \source2\
with some files which are common and files which exist only in either folder, running
robocopy source source2 /L /NJH /NJS /NP /NS
yields
D:\Users\me\test\source\
*EXTRA Datei only_in_source2.txt
Neue Datei only_in_source.txt
where lines starting with a *
denote files only in source2
(independent of the OS language), and other lines denote files only in source
.
The options suppress various output items, and /L
takes care that differences are listed only, not copied.
Solution 2
This Powershell script does what you want.
$fso = Get-ChildItem -Recurse -path C:\Temp\Source
$fsoBU = Get-ChildItem -Recurse -path C:\Temp\Source2
Compare-Object -ReferenceObject $fso -DifferenceObject $fsoBU
That, and several other options, are discussed here: https://stackoverflow.com/questions/3804109/what-is-the-best-way-to-compare-2-folder-trees-on-windows
Related videos on Youtube
NotepadPlusPlus PRO
Coder. Writer. Blogger. Tech enthusiast. Notepad++ PRO.
Updated on September 18, 2022Comments
-
NotepadPlusPlus PRO over 1 year
I would like to compare two folders, strictly for filenames. (Not the file contents). I am on windows 10 and would like to use command line tools.
Here is scenario that may explain the issue.
Folders ------- source source2 - file_1 - file_1 - file_2 - file_2 - file_3 - file_4 - file_5 - file_5 - file_6 - file_7 Output should be: ----------------- Source -> Missing files file_4 Source2 -> Missing files file_3
I did some research, and there are many
diff
tools, but I am not interested in comparing the file contents. All I want is compare two folders and output which files are missing in both folders (compared to the other one).I prefer not to use Powershell.
Thank you.
-
NotepadPlusPlus PRO about 5 yearsthanks, I cannot use Powershell. Really appreciate your answer though.
-
Doug Deden about 5 yearsWhy can you not use Powershell?
-
NotepadPlusPlus PRO about 5 yearsThanks. This is exactly what I was looking for.
-
antonio over 3 years@user1016274 Find fast which files are missing after Windows Update. C:\Windows\Microsoft.NET\Framework\v3.5\ *EXTRA File Microsoft.Build.Tasks.v3.5.xml *EXTRA File Microsoft.CompactFramework.Build.Tasks.dll *EXTRA File Microsoft.CompactFramework.Common.targets *EXTRA File Microsoft.CompactFramework.CSharp.targets *EXTRA File Microsoft.CompactFramework.VisualBasic.targets Thanks