Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do "diff -r" of UNIX in Windows Cmd Prompt?

Tags:

windows

cmd

People also ask

What is the diff command in Windows?

You can use the diff command to show differences between two files, or each corresponding file in two directories. diff outputs differences between files line by line in any of several formats, selectable by command line options. This set of differences is often called a `diff' or `patch'.

Is diff a Unix command?

On Unix-like operating systems, the diff command analyzes two files and prints the lines that are different. In essence, it outputs a set of instructions for how to change one file to make it identical to the second file.

How do I diff two directories in UNIX?

Use the dircmp command to compare two directories specified by the Directory1 and Directory2 parameters and write information about their contents to standard output. First, the dircmp command compares the file names in each directory.

What is Rd S in CMD?

rd = remove (delete) a directory. /S = removes all directories and files in the specified directory in addition to the directory itself.


Install Cygwin and you can use diff -r on Windows.


The comp command for Windows is what you're looking for.

Here the example:

To compare the contents of the directory C:\Reports with the backup directory \\Sales\Backup\April, type:

comp c:\reports \\sales\backup\april 

The easiest way would probably be downloading diff for Windows: http://gnuwin32.sourceforge.net/packages/diffutils.htm
You could also do something like:

dir directory1 > dir1
dir directory2 > dir2
comp dir1 dir2

Also, some versions of Windows comes with windiff, however that is a GUI tool


In Windows there is the fc command. I think diff is way better, but if you want to use only what came with the installation, well, here you go! :)