Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am manipulating a whole bunch of files and placing them in a different directory. What I need to do now is find out which files are in the original directory that aren't in the output directory (the problem is being processed by a dozen computers). Is there any script I can run on Windows that will display this?

share|improve this question

migrated from Jan 29 '10 at 7:44

This question came from our site for professional and enthusiast programmers.

up vote 7 down vote accepted

Use WinDiff. It comes with Visual Studio and Platform SDK and can be downloaded separately. It's mainly to compare files, but it also allows you to recursively compare folders.

share|improve this answer

If you are looking for a manual process and have visual studio installed, then you can use windiff.exe to show the differences.

share|improve this answer

In PowerShell:

$d1 = get-childitem -path $dir1 -recurse 
$d2 = get-childitem -path $dir2 -recurse 
compare-object $d1 $d2 
share|improve this answer
I did this between a dir on my USB card and my local computer. 10 mins later, still waiting... – jcollum Jun 5 '11 at 17:38

I tend to use PathSync

share|improve this answer

you can try this vbscript, no need to download any stuff.

Set objFS = CreateObject("Scripting.FileSystemObject")
Set d = CreateObject("Scripting.Dictionary")
Set objArgs = WScript.Arguments
strFolderA= objArgs(0)
strFolderB = objArgs(1)
Set objFolder = objFS.GetFolder(strFolderA)
Set objFolder1 = objFS.GetFolder(strFolderB)
For Each strFile In objFolder.Files
    strFileName = strFile.Name
    strFilePath = strFile.Path
    'collect all files and their full paths.
    d.Add strFileName, strFilePath

For Each strFile In objFolder1.Files
    strFileName = strFile.Name
    strFilePath = strFile.Path
    If Not d.Exists(strFileName) Then
        WScript.Echo "Not found in : " & strFolderA & "->" & strFilePath
    End If 


C:\test>dir /B c:\tmp

C:\test>dir /B c:\tmp1

C:\test>cscript //nologo test.vbs c:\tmp1 c:\tmp
Not found in : c:\tmp1->C:\tmp\file
share|improve this answer

FreeCommander does this quickly. Pick folder on right, pick folder on left, compare. It's a handy utility.

share|improve this answer

In cygwin

comm <options> <(cd $dir1;find -type <type>|sort)  <(cd $dir2;find -type <type>|sort) |less -S

The comm command gives three columns of output unless you suppress them.

I used -S so less doesn't wrap and you can see the columns clearly.


  • -23 shows what is unique to $dir1 in first column, suppresses other two columns
  • -13 shows what is unique to $dir2 in second column, suppresses other two columns
  • -12 shows every thing the same between $dir1 and $dir2, suppresses first two columns


f for just files d for just directory or use type twice with both or remove type altogether for everything.


Note haven't tested the below I assume the pipe works in CMD.

If you got findutils and coreutils from here (because you don't want cygwin) and the less package (but you can use > \somepath\file instead of |less -S then notepad file etc).

cd %dir1%
find -type <type> | sort > \somepath\file1
cd %dir2%
find -type <type> | sort > \somepath\file2
comm <options> file1 file2 |less -S

Note replace $... and #...# with the paths if you don't know how to make variables :)

share|improve this answer
It would be nice to have something that compares many directory's and then gives what DIRs have the most in common and what they don't have among the many (of course you could do some bash tricks with the above). Will try WinDiff – sabgenton Jan 21 '13 at 6:51
I don't know if it's just me but PS compare-object $d1 $d2 was slow for me. – sabgenton Jan 21 '13 at 6:53

You must log in to answer this question.

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