BC4 Script display-left-newer-orphans

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedOctober
    New User
    • Apr 2013
    • 2

    BC4 Script display-left-newer-orphans

    Goal:

    I have to compare two folder trees, FdrTreeA and FdrTreeB. FdrTreeA the active folder that is changing daily. FdrTreeB is stable, unchanging, until I decide to update it. Once a month, I want to use a BC script to produce a summary report that lists three things:

    - Files on FdrTreeA that are not on FdrTreeB (left-orphans?)
    - Files on FdrTreeA that are newer than the same named, same positioned, file in FdrTreeB (left-newer?)
    - Files on FdrTreeB that no longer exist in FdrTreeA (right-orphans?)

    I have written the following script:.

    log "D:\mylogfdr\bc_log\mylog.txt"
    criteria rules-based
    filter *.*
    load "D:\myfdr\root_a" "D:\myfdr\root_b"
    expand all
    select all.files
    folder-report layout:summary options:display-left-newer-orphans,column-none title:MyTitle output-to:"D:\rpt\bc_rpt\my_smry.txt"

    This script runs without error, but doesn't do what I need. The report only shows left-orphans, not left newer nor right-orphans. ("&" line joiner not shown because I did not need it in my text editor. It's all on one long folder-report line.)

    Here is the report:

    MyTitle
    Produced: 2016-Jan-31 3:52:21 PM

    Mode: Left Newer and Left Orphans
    Left base folder: D:\myfdr\root_a
    Right base folder: D:\myfdr\root_b

    Left Orphan Files (2)
    ---------------------
    2\2A.txt
    2\2C.txt
    ---------------------

    Left Newer Files (0)
    ---------------------

    This report is incorrect because there is a file at "root_a\2\2B.txt" that is newer, time-wise and content-wise than it's counterpart in "root_b\2\2B.txt". You can see that it is not listed.

    Because it seems there can be only one "display" parameter, I can't do this:

    options:display-left-newer-orphans,display-right-orphans


    As a result, the file "root_b\3\3C.txt" which doesn't exist in the root_a folder, is not listed as a right orphan.

    How can I accomplish my goal in my script?

    Thanks in advance.
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    You aren't seeing your currently expected results because your criteria is rules-based only (removed timestamp), so there are no "newer" files if timestamp isn't compared.

    criteria timestamp:2sec rules-based

    would use both criteria for the comparison, so a rules-based equal file will still be equal, but a rules-based different file can still be Older or Newer.

    We do not have a script report that covers Orphans Both Sides And Left Newer. You could generate two reports: left-newer and then display orphans, would give you a combination.

    log "D:\mylogfdr\bc_log\mylog.txt"
    criteria timestamp:2sec rules-based
    load "D:\myfdr\root_a" "D:\myfdr\root_b"
    expand all
    folder-report layout:summary options:display-left-newer,column-none title:MyTitle output-to:"D:\rpt\bc_rpt\my_smryLeftNewer.txt"
    folder-report layout:summary options:display-orphans,column-none title:MyTitle output-to:"D:\rpt\bc_rpt\my_smryOrphans.txt"
    Aaron P Scooter Software

    Comment

    Working...