No announcement yet.

Output filenames from folder comparison to a file

  • Filter
  • Time
  • Show
Clear All
new posts

  • Output filenames from folder comparison to a file


    I'm looking for a script that will help me to compare two folders, and output the filename of any files that don't match to an output folder.

    For testing, I've copied folder A to folder B and then modified a file in folder B.

    My current version of the script is below with the result it produces also below.

    a) the modified file shows up as a "newer" file - but I'd much rather it be a different file - any advice?
    b) is there a way to just produce a list of filenames that are different?

    SCRIPT **************

    # Load the base folders.
    load "folder A" &
    "folder B"

    # Report
    expand all
    folder-report layout:summary options:display-mismatches &

    RESULT ***********

    Folder Compare
    Produced: 26/06/2018 10:05:47 AM

    Mode: Differences
    Left base folder: Folder A
    Right base folder: Folder B

    Left Orphan Files (0) Size Modified

    Right Orphan Files (0) Size Modified

    Left Newer Files (0) Size Modified

    Right Newer Files (1) Size Modified
    UD-19020X-SR5478-Script02-JSC.sql 3,010 1/06/2018 8:32:16 AM
    3,025 26/06/2018 9:01:51 AM

    Difference Files (0) Size Modified

  • #2

    You are currently using the folder-report options: setting to limit the current view. There isn't a way to trim this report further to only filenames; the general report structure (header section, and descriptive header paragraphs) are still present in report generation.

    Let me briefly explain file criteria (Newer vs. Different). A "Newer" status is used when a difference is detected and timestamp is available, so that one side is "Newer" or "Older". This helps with syncing, as an Update won't overwrite an Newer file with an Older file.

    "Different" status is used when files are different (sizes, binary scan, etc) but the timestamp is the same. Since any file updates should also update the timestamp, this is a state that usually requires review, since BC4 wouldn't be able to determine which file should be replaced during a sync as something odd may have happened, or a corruption.
    However, you can remove timestamp as a criteria, which means any difference in content will then be Different, without knowing Newer or Older. Before your "load" line, use the "criteria" command to set the criteria the load should subsequently use:
    criteria rules-based
    load "folder a" "folder b"
    Aaron P Scooter Software