Tapatalk

How to do a Quick Compare of 2 directories?

How to do a Quick Compare of 2 directories?

2
NewbieNewbie
2

    Apr 10, 2010#1

    How to do a Quick Compare of 2 directories?

    Quick Compare works fine, when comparing 2 files.
    Example:
    uc -qc "F:\1\New.txt" "F:\2\New.txt"
    Same

    But how can the UC program (UltraCompare) do Quick Compare for all files and all folders in a directory?

    The desired end result after comparing 1000's of files in dozens of directories would be something like this: (-d = directory)
    uc -qc -d "F:\1\" "F:\2\"
    Same

    Background, using:
    Win XP Pro
    UltraCompare version 7.00.0.1018

    6,685587
    Grand MasterGrand Master
    6,685587

      Apr 10, 2010#2

      There is no quick folder compare option. You can use the following batch file. For a description see the comments which are the lines starting with command rem.

      @echo off
      rem Run a full binary recursive folder compare with not equal results written into a text file.
      uc.com -fb -dmf -r -d F:\Temp\Test1\ F:\Temp\Test2\ -ne -o F:\Temp\Result.txt

      rem Check if a binary file is listed in the results file because of a difference.
      %systemroot%\system32\find.exe /c "| Binary    |" F:\Temp\Result.txt >nul
      if errorlevel 1 goto !CheckText
      rem Different binary file listed in the results file.
      echo "DIFFERENT"
      goto !Exit

      :!CheckText
      rem Check if a text file is listed in the results file because of a difference.
      %systemroot%\system32\find.exe /c "| Text      |" F:\Temp\Result.txt >nul
      if errorlevel 1 goto !CheckEmptyDir
      rem Different text file listed in the results file.
      echo "DIFFERENT"
      goto !Exit

      :!CheckEmptyDir
      rem Check if an empty subdirectory exists in one folder and not in the other.
      %systemroot%\system32\find.exe /c " none " F:\Temp\Result.txt >nul
      if errorlevel 1 goto !AllEqual
      rem Different empty subdirectories in one or both folders.
      echo "DIFFERENT"
      goto !Exit

      :!AllEqual
      echo "SAME"

      :!Exit
      del F:\Temp\Result.txt >nul
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Apr 10, 2010#3

        Hello Mofi
        Thank you for this idea.

        But there is 1 thing that did not work for me:

        " none " in CheckEmptyDir does not work for me because " none " exist when directories ARE the same.

        Here is what is being tested....

        @echo off
        uc.com -fb -dmf -r -d "f:\1\" "F:\2\" -ne -op "F:\TemP1.txt"

        :!CheckText
        C:\WINDOWS\system32\find.exe /c "| Text" "F:\TemP1.txt" > "F:\TemP2.txt"
        if errorlevel 1 goto !CheckBinary
        echo Different - Text
        goto !Exit

        :!CheckBinary
        C:\WINDOWS\system32\find.exe /c "| Binary" "F:\TemP1.txt" > "F:\TemP2.txt"
        if errorlevel 1 goto !CheckEmptyDir
        echo Different - Binary
        goto !Exit

        :!CheckEmptyDir
        C:\WINDOWS\system32\find.exe /c " none " "F:\TemP1.txt" > "F:\TemP2.txt"
        if errorlevel 1 goto !AllEqual
        echo Different - Directory
        goto !Exit

        :!AllEqual
        echo Same
        Pause

        :!Exit
        Pause

        6,685587
        Grand MasterGrand Master
        6,685587

          Apr 11, 2010#4

          I'm using UC v7.10.0.1012. This version does not write equal directories into the results file with word none. Command line parameter -ne should result in having only different files and folders in the results file. The word none should be present only in the results file when either a subdirectory or a file exists in only one of the 2 directories. For the tests I have done this works.
          Best regards from an UC/UE/UES for Windows user from Austria