Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2013
    Posts
    10

    Default How to get comparing result with scripts?

    I have a comparing task as below, how to do it?
    #1. Compare two folders via scripts.
    #2. If different, Export differences report and open it with IE.
    #3. If identical, Do others tasks.

    After investigating, I found
    #1. BC always export diffs report even if two folders are identical.
    So I cannot check file exist or file size.
    #2. BC does not support return result (errorlevel) when comparing folders.
    So I have to export diffs report, parse it and get comparing result.

    Do you have any suggestion for me? Thanks.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Correct, the report will always be generated using BC3 script. The Layout:XML shouldn't be too difficult to parse. It would not contain any relevant nodes if the report were 'empty', and can be set to show only differences.

    I would recommend using the graphical interface first (Folder Compare session, Session menu -> Folder Compare Report, layout XML). Test out the different report options to see which set works best for you, and you can then use that configuration in your script.
    Aaron P Scooter Software

  3. #3
    Join Date
    Apr 2013
    Posts
    10

    Default

    Thank you so much for your reply and suggestion.

    I get xml-formatted differences report according to your method, and I also get different file list with parsing "filecomp" element and "status" attribute. but how to parse one orphan and empty folder? (No keyword for parsing)

    DiffsDummy is rtonly and empty.
    <foldercomp>
    <lt>
    <name>local</name>
    </lt>
    <rt>
    <name>local</name>
    </rt>
    <foldercomp>
    <rt>
    <name>DiffsDummy</name>
    </rt>
    </foldercomp>

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Hello,

    If I understand correctly, you are trying to find only folders that are empty and exist on one side (orphan)?

    We do not have this as a comparable status, since BC3 compares files and then shows the folders to those files by default. The folders themselves are not generally compared. You could enable the view mode to Compare Files and Folder Structure, but this would show all folders, not just those without files. If you issue an Expand All first, you could parse then for only folders that do not have files inside of them.

    The View mode would need to be set in the graphical interface first. We do not have that option in scripting.

    Or are you trying to exclude empty folders? If so, the View mode Only Compare Files would work after you use Expand All in scripting.
    Aaron P Scooter Software

  5. #5
    Join Date
    Apr 2013
    Posts
    10

    Default

    Hello Aaron,

    Your first understanding is right, and thank you for your explanation.

    I export difference report according to your method, But the difference report is same as my previous one. Of course, I can understand your said (We do not have this as a comparable status, since BC3 compares files and then shows the folders to those files by default. The folders themselves are not generally compared.), So please tell me if you have others idea.

    BTW, How to upload files for your information?

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,616

    Default

    Unfortunately, there is not a way to do this in scripting or using an automated method. If your folder structure had no subfolders (an empty folder inside a non-empty folder), then we could try a series of steps in the graphical interface to show all empty folders. However, this workaround does not work if there is an empty folder inside a non-empty folder; that case would be excluded.

    If you click "Go Advanced" you can attach files to your post, or you can email us at support@scootersoftware.com. If you email us, please include a url link to this forum thread for our reference.
    Aaron P Scooter Software

  7. #7
    Join Date
    Apr 2013
    Posts
    10

    Default

    Thank you so much, I got it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •