Berker Yüceer
Berker Yüceer

Reputation: 7335

Comparing two folders for non identical files in CMD

What I need to do is to compare two folders for non identical files in CMD with DOS commands.

When I find non identical files, I need to write them into a .txt file with full path so I can find out where these files are actually contained.

So how can I achieve this?

Upvotes: 6

Views: 43376

Answers (3)

vulkanino
vulkanino

Reputation: 9134

You could use the comp command: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/comp

comp C:\PathA\A C:\PathB\B > C:\Comparison\comparison-between-A-B.txt

Upvotes: 11

user3396611
user3396611

Reputation: 31

If the directory you want to inventory includes files and other subdirectories then you must use the /S switch in order to "get" everything in your output.

Upvotes: 3

Berker Yüceer
Berker Yüceer

Reputation: 7335

This is just another way to do it for those who might have problems with comp command..

With comp i had some problems so i found another solution by using :

dir D:\Projects\Comparison\YourFolder\ > D:\Projects\Comparison\filelist-you.txt

so this creates a filelist of folder than i did the same on my second folder which is gonna be compared..

dir D:\Projects\Comparison\MyFolder\ > D:\Projects\Comparison\filelist-me.txt

Than i compare them with this code:

fc D:\Projects\Comparison\filelist-you.txt D:\Projects\Comparison\filelist-me.txt 

gives the true result..

Everything was fine till this step than i couldnt find out how to put these comparison results into a new .txt file..

Than i realized("with the help of @vulkanino") i already had the answer as dir path1 > intopath2 so the solution is :

fc D:\Projects\Comparison\filelist-you.txt D:\Projects\Comparison\filelist-me.txt > D:\Projects\Comparison\filelist-comparison-between-you-me.txt

">" is an output command that directs the output to the decided path.

Upvotes: 4

Related Questions