Script to display orphans ONLY

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bojomojo
    Journeyman
    • Apr 2011
    • 15

    Script to display orphans ONLY

    Hello,
    I am trying to make a script to display orphan files only between two directories..

    I am using
    filter "*.h;*.c;*.txt;*.pl"
    load "%1" "%2"
    expand all
    select all
    folder-report layout:side-by-side options:display-orphans title:"Title here" output-to:%3 output-options:html-color

    This is not working, it displays all Folders, but display orphan files only, I don't want anything to be listed except the orphan files and the folders they are in, how is that possible.
    I am using BC3 on linux

    When I try it from the GUI it displays the orphans and thier folders only, but when I use the script it dislpay all folders, and orphan files, I even exported an HTML-Report from the GUI and it was fine, but when I use the same settings for the script it generates All the subfolders included in the main folder(without the files in them) and the orphan files

    Edit: This should be moved to BC3 forums. Please move it and help me do this script
    Last edited by bojomojo; 27-Apr-2011, 04:51 AM.
  • Michael Bulgrien
    Carpal Tunnel
    • Oct 2007
    • 1772

    #2
    If you have a compare working the way you want in the GUI, save it as a named session, then open the named session in your script instead of opening the individual files. This will allow your script to inherit the session settings that you've defined and saved from the GUI.
    BC v4.0.7 build 19761
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    Comment

    • bojomojo
      Journeyman
      • Apr 2011
      • 15

      #3
      How can I load that session from the script
      Please note that each time I load the session, I want to load 2 different folders.
      Also note the script will run on different PCs, what files should I attach with the script to load the session.

      Thanks
      Last edited by bojomojo; 27-Apr-2011, 09:48 AM.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16000

        #4
        If you open a new, blank Folder Compare in the interface, if you go to the View menu, is Always Show Folders enabled? You will want to switch to either Compare Files and Folder structure, or Only Compare Files. You can save this as a blank session, and then load it before loading your folders in script to pass on any session settings:

        load sessionName
        filter "*.h;*.c;*.txt;*.pl"
        load "%1" "%2"
        ....
        Aaron P Scooter Software

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 16000

          #5
          You can also just set the setting in the graphical interface and it will apply in script. But if you change it later in the graphical interface, it will also impact future script runs.
          Aaron P Scooter Software

          Comment

          • bojomojo
            Journeyman
            • Apr 2011
            • 15

            #6
            The script will run on different PCs with different GUI configs, will that work?
            I want it to produce the same results in all cases

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 16000

              #7
              The option can only be set in the GUI or by using a saved session. As long as multiple PCs have the same sessions (Tools menu -> Import/Export), or are networked (use the Shared Sessions option), or you set the option in the GUI on each PC, then they would generate the same way.

              Did switching that option work for you?
              Aaron P Scooter Software

              Comment

              • bojomojo
                Journeyman
                • Apr 2011
                • 15

                #8
                I saved the session with the name EmptyOrphans, then exported it and using the following script

                load BCPreferences.bcpkg
                filter "-*svn*;-.metadata/;-.svn/"
                load "%1" "%2"
                expand all
                select all
                folder-report layout:side-by-side options:display-orphans title:"Tree Comparison Result" output-to:%3 output-options:html-color


                But still no differences, all the subfolders appears in the report, but only the orphan files, while in the GUI the orphan files only appear

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 16000

                  #9
                  Hello,

                  You have to import your settings so that the session is displayed in the saved sessions list. You can use the Tools menu -> Import dialog to import your BCPreferences.bcpkg.

                  Then you would reference it by the name in the saved sessions list.
                  load "EmptyOrphans"
                  filter "-*svn*;-.metadata/;-.svn/"
                  load "%1" "%2"
                  ....
                  Aaron P Scooter Software

                  Comment

                  • bojomojo
                    Journeyman
                    • Apr 2011
                    • 15

                    #10
                    The problem is, the script is needed to run on different PCs, I just want to run the script without doing any manual importing..
                    Is that possible?

                    If not, then can we see why the display-orphans option shows all folders??

                    Comment

                    • Aaron
                      Team Scooter
                      • Oct 2007
                      • 16000

                      #11
                      Hello,

                      The default display of Beyond Compare 3 will Compare Files and Folder Structure. This will show only folders that are orphan folders (with potentially orphan files in them) or Orphan files and the folders they are in.

                      If you have switched from the defaults by selecting Always Show Folders, then you will need to perform the above steps to make the script switch back.

                      I am not sure if this is the problem or not. Have you confirmed that the Always Show Folders is enabled and is the reason you are seeing all folders in the report? If it isn't, we'll need to resume troubleshooting on what is causing the problem. We need to get it working on one machine before we can consider solutions for multiple.
                      Aaron P Scooter Software

                      Comment

                      • bojomojo
                        Journeyman
                        • Apr 2011
                        • 15

                        #12
                        Ok, "Always Show Folders" was already chosen, so I switched it to compare folder structure, and saved the session and tried again, still no difference.

                        When I switch to "summary" instead of "side by side" it lists the orphan files only, but in side by side it displays all the folders (without the files in them) + the orphan files
                        Last edited by bojomojo; 02-May-2011, 02:56 AM.

                        Comment

                        • Aaron
                          Team Scooter
                          • Oct 2007
                          • 16000

                          #13
                          Hello,

                          When you mention "all the folders" is it literally all folders or some of the folders? Compare Files and Folder Structure is the default view mode and will display any Folders that are Orphans. If you want only the Orphan files, you will need to switch to Compare Only Files. This will still show the folder structure down to the orphan file; the side-by-side view will show the same information as the graphical Folder Compare session.

                          Does switching to Compare Only Files for a Side-By-Side view show the report you are looking for? You can also test this in the graphical interface using the Session menu -> Folder Compare Report dialog to quickly toggle different settings to see which configuration you want to use. If you need to enable Compare Only Files, you will need to change the setting on each computer you install Beyond Compare on (by script as discussed or graphically); we do not currently support changing that setting by script.

                          Would using a Summary Report (which does not require you to change to Compare Only Files) work for you?
                          Aaron P Scooter Software

                          Comment

                          • bojomojo
                            Journeyman
                            • Apr 2011
                            • 15

                            #14
                            It shows all the folders.
                            This is the problem,
                            the report doesnot show the same view as the GUI.
                            Also no matter what I do, if I change "Always Show Folders" to anything, and close bcompare, it goes back to it again. Even when I save the session.

                            I need a script to run on different machines without any pre-configuration on the machine that will generate the same orphans report. Is that possible?

                            Comment

                            • Aaron
                              Team Scooter
                              • Oct 2007
                              • 16000

                              #15
                              Hello,

                              If you open a blank, new Folder Compare session in the interface, switch to Only Compare Files, go back to the Home screen, and then back to a blank, new Folder Compare, you see it update and return to Always Show Folders?

                              That is not the expected behavior. If you open a session, change the button, and re-save the session, those settings should be saved and it should remain on Only Compare Files. The default settings described above to not need the 'save' step.

                              Could you email us at [email protected] :
                              - a copy of your Support package (Help menu -> Support; Export).
                              - a link back to this forum post for reference.
                              Aaron P Scooter Software

                              Comment

                              Working...