tags:

views:

95

answers:

1

Hello Everyone, I have two folders. I want to compare the files inside these folders.There are some subfolders in root folders. These sub folders are also containing some files. I want to compare these files in subfolder also. For that I am trying to write a batch file. Any kind of solution will help me a lot

A: 

I would not use a batch file at all to accomplish this task. BeyondCompare is here to do exactly that, and does it seemingly well.

Now on the other hand you really wanna do it via batch file, I'd suggest you install a tool called diff tools, and you'll be able to do something like:

diff.exe <file1> <file2> <htmlfile>

On the command line.

hope it helps

UPDATE As a follow up to your comment, I write this, which also seems to work for me, and doesn't use any external tool. This is a simple example, but you can make it better.

if exist compare.log del compare.log if exist missing.log del missing.log

for /f "delims=" %%a in ('dir/b/a-d c:\test\1') do (
    if exist "C:\test\2\%%a" (
        fc "c:\test\%%a" "C:\test1\%%a" >> compare.log
    ) else (
        echo %%a is missing >> missing.log
    )
)

Pause

Marcos Placona
I want to use only batch commands or batch files. Is there any script/command that checks for files in folders and subfolders and compare it with specified other folder.
WENzER
posted an update regarding your comment
Marcos Placona
I have already tried this one but this one is giving comparision for the files in root folder not for subfolders
WENzER