How do I compare two directories on cmd prompt of Windows m/c? I want equivalent of diff -r of UNIX.
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
相关文章
- 在vscode如何用code runner打开独立的控制台窗口,以及设置好调试模式时窗口的编码?
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- CosmosDB emulator can't start since port is al
- How to print to stdout from Python script with .py
Partial solution with ROBOCOPY
A partial solution (and thus for me unfortunately a "non-solution", although I had high hopes for it initially), which may or may not be enough for you:
It seems the ROBOCOPY tool can be (ab-)used to work as a kinda poor man's recursive comparison; with the unfortunate limitation, that it apparently doesn't compare file contents. It seems to compare sizes, dates and optionally attributes. The magic incantation for this would be:
where options meaning seems to be:
/e
- recurse, including empty directories;/l
- only print a log, don't modify files;/ns /njs /njh
- don't print file sizes, job summary, job header;/ndl
- "don't log folder names"/log:result.txt
- write results to 'result.txt' file; I think this can be omitted and result will be shown on standard output then.Additional options:
/it
- I think this should be added if you want to compare attributes too - see an explanation on what "tweaked" files are.Warning: does NOT compare file contents
As I said above, this seems not to compare file contents, unfortunately. I verified this by running the following command first:
Most of the time, this should produce files d1\a\b\f and d2\a\b\f with same timestamps, you can verify with
dir d1\a\b\f d2\a\b\f
. Therobocopy
call on d1 & d2 produced an empty result set for me.You can use windiff util included in Windows from NT version and up. Just run 'windiff' and a graphic tool will pop up.
File -> Compare directories
http://msdn.microsoft.com/en-us/library/aa266122(VS.60).aspx
This article describes how to use it from command line. Great benefit of this tool is that it is already included and you don't need to download and install anything.
You can install Gow, and you can run diff in the Windows Command Prompt.
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:
In Windows 10 you can run
diff
command inbash
by Enabling the Linux Bash ShellThe easiest way would probably be downloading diff for Windows: http://gnuwin32.sourceforge.net/packages/diffutils.htm
You could also do something like:
Also, some versions of Windows comes with
windiff
, however that is a GUI tool