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

Is there an out of the box way to compare two folders in Windows 7? The comparison should show the differences in terms of subdirectory folders and subdirectory files.

share|improve this question
powershell script? – strange walker Nov 25 '13 at 21:16
@strangewalker Is that available out of the box ? – happybuddha Nov 25 '13 at 21:29
yep. though it may be difficult to write a script for someone without experience, its capabilities are almost limitless – strange walker Nov 25 '13 at 21:34
If you willing to experiment with powershell, here's topic with similar question… – strange walker Nov 25 '13 at 21:36
@strangewalker can you whip one ? Or do you know where these are available to be used by everyone ? Also you should make this into an answer. This helps and I will upvote – happybuddha Nov 25 '13 at 21:56

I'm not a powershell pro, but this would give you which files and folders exist in one folder but not the other.

$test1 = get-childitem -path C:\Users\IrisDaniela\Documents\test1 -recurse
$test2 = get-childitem -path C:\Users\IrisDaniela\Documents\test2 -recurse
compare-object $test2 $test1 | Where {$_.SideIndicator -eq '=>'}

This gives:

InputObject                                                 SideIndicator
-----------                                                 -------------
test1a                                                      =>
test.txt                                                    =>

You can also leave out the filtering of course, and get:

$test1 = get-childitem -path C:\Users\IrisDaniela\Documents\test1 -recurse
$test2 = get-childitem -path C:\Users\IrisDaniela\Documents\test2 -recurse
compare-object $test2 $test1

InputObject                                                 SideIndicator
-----------                                                 -------------
test1a                                                      =>
test.txt                                                    =>
test2b                                                      <=

Dunno if this is what you are looking for, but maybe it gives you a start :)

The folders in the example The commands and result

To compare content use: compare-object (get-content a.text)(get-content b.txt) and so on

share|improve this answer

There is a good unix tool named diff, which you can install from cygwin.

On win, there is a gui tool named beyondCompare.

share|improve this answer
Thank you for your reply. Is there anything OOTB available in windows 7 ? I cannot install anything on this computer am working on. – happybuddha Nov 25 '13 at 21:29
Cygwin tools can you run without installation, too, although it needs a little work. If you have luck, there is the same situation with beyondcompare, too. The simplest solution is to install this at home, and copy their folders on a pendrive. Be sure you don't do sometjing against the local network regulation, I couldn't very long sleep well if you losed your job because my advices :) – peterh Nov 25 '13 at 21:32
@happybuddha Download a differ such as WinDiff, WinMerge, or similar. Copy it to a share available to this machine over the network. Execute it from there. \\myserver\myshare\windiff.exe localfolder1 localfolder2 – Mark Allen Nov 26 '13 at 0:16
Here's another vote for BeyondCompare. – Daniel R Hicks Nov 26 '13 at 3:43

You can make a batch file that creates two temporary text files that contain the directory structure, then compare those temp files with fc.

Something like (and adjust for preferences):

dir %1 /s /b /a /ong > temp1.txt
dir %2 /s /b /a /ong > temp2.txt
fc temp1.txt temp2.txt

The arguments for the dir command are: /s recurse into child folders /b don't show details, you could want to omit this maybe /ong sort by ascending name, directories first

Also, remember to adjust for possible spaces in the arguments

EDIT: as noted in the comments, we'll have to get rid of the directory prefix from the list-of-files text file. This can be done with a batch file such as:

@echo off
setlocal EnableDelayedExpansion

for /F "delims==" %%a in (%1) do @(
    set CURR_LINE=%%a
    @echo !CURR_LINE:~%2!


used as unprefix text_file.txt prefix_length. So for example unprefix temp1.txt 5 will output the contents of temp1.txt without the first 5 characters of each line.

share|improve this answer
dir /s /b always displays the absolute path so every line will have a different path prefix which will cause fc to report every line. You will need a tool to strip the path prefix before the comparison. – Adrian Pronk Nov 29 '13 at 20:12
ah yes, you're absolutely right. – frozenkoi Nov 29 '13 at 21:45

I use FreeCommander (a Norton Commander clone) to do this. It provides "Synchronize Folders" feature that allows to compare two folders and optionally synchronize them. The compare options include "By CRC", "By date", "By Content", Sub Folders and mane more. It is very powerful and has helped me many time to perfectly do the very same thing you asked.

Generally, FreeCommander is very powerful tool. the other feature that I use often is search withing files and folders.

share|improve this answer

You must log in to answer this question.

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