Compare files with partially matching file names?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chris
    Team Scooter
    • Oct 2007
    • 5538

    #46
    leninstimpy,

    This behavior (aligning a zip file with non-archive file) should be fixed in BC 4.0.1 that was released today.
    Chris K Scooter Software

    Comment

    • mebanbur
      New User
      • Nov 2014
      • 1

      #47
      I am trying to compare two folders with different versions of the same project. The files names contain the original file names along with the version number ie:
      CLIPPING_REGIONS_70_S.ADA => CLIPPING_REGIONS_56_S.ADA
      CLIPPING_REGIONS_71_B.ADA => CLIPPING_REGIONS_57_B.ADA

      I have tried in the Folder Compare mode to force these files to correctly compare by using the following Alignment Override:
      ^([A-Z0-9_]+)_[0-9]+_([B|S])\.ADA=$1.+$2\.ADA
      No luck.
      Any Ideas to get the file names to align?

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16017

        #48
        Hello,

        The changing version number needs to be part of the "with right"mask. While Regular Expressions can be used to Find/Left a changing version number, any text that does not match $1 or $2 exactly would need to be explicitly included in the Right side. The Right Side's dropdown of RegEx is limited to the Tagged Expressions.
        Aaron P Scooter Software

        Comment

        • Abdullah Eyles
          New User
          • Dec 2014
          • 1

          #49
          Hello all,

          Sorry but I haven't been able to solve my simple problem (and I don't have time to read all 48 pages of this forum).

          I'm trying to get the first 30 or so characters of my filenames to match (Align). I've tried almost everything and at the moment have this expression:

          right
          (.{1,20}).*
          left
          $0 (sometimes I tried $1 to no avail!)

          Please tell me how I can do a simple match. At the moment files are coming out on different lines rather than matched on the same line.

          I've also tried "manually aligning" and then editing the strings but it captures the whole filename rather than just a few similar characters.

          Many thanks for your help!

          Abdullah Eyles

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 16017

            #50
            Hello,

            The Alignment Overrides allows masking to match the matching part of the name, such as (stuff) with $1. However, any differences in file names needs to be explicitly defined. The 'matching' side does not support additional masking, it only supports $1, $2, and up, so anything that isn't a found match from the Find side needs to be explicitly typed in. If you have randomly changing characters in the Replace With side, then we won't be able to match on them arbitrarily.
            Aaron P Scooter Software

            Comment

            • rgbigel
              Visitor
              • Jul 2014
              • 4

              #51
              The wish list request still seems to be open after that many years!
              Correct me if i'm wrong, but all it would take is something like this:
              1. create left hand string from left hand file name using regex, filling $1 (and maybe $2, $3 ...)
              2. create right hand string from right hand file name using (full) regex semantics (with ref. to $1, $2, ... allowed)
              3. match the two created strings and use to align
              Because this sort of solution still does not exist in Version 4, I can see no reason to upgrade until it does work.
              PS. of course there could be more elegant or powerful solutions but first follow the KISS philosophy.
              Rolf

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 16017

                #52
                Hello,

                Thanks for the feedback. Enhancing our Alignment Override feature is something on our wishlist. Given the complexity of Regular Expression support, even the KISS solution is non-trivial to implement. If you would like to post example cases of folder structure and file names you are trying to align, and how you would like to define an Override to perform that task, I can add these notes to our entry on the subject. This would help expand our test cases that our developers use while investigating features like this.
                Aaron P Scooter Software

                Comment

                • jspencer
                  Visitor
                  • Apr 2016
                  • 4

                  #53
                  I think a good suggestion might be to add more replacement tags that allow different matching behavior that exactly equal. My recurring example is I'd like to compare files from folders that look like this:
                  fileA_1234.txt --> fileA_5678.txt.
                  fileB_2345.txt --> fileB_6789.txt

                  So I'd like to make the right side be (file\w)_\d+.txt and the left side something like $1_<as many digits as matched on the other side>.txt
                  This replacement field I'd like to ignore in the comparison. They are actually timestamps or other auto-generated content, and for the purposes of the compare, I don't care what their values are.

                  So, the suggestion is a set of new replacement tokens, ala:
                  $^1 -- the first pattern on right does NOT match here
                  $?1 -- the right pattern doesn't matter--it can be in left or not
                  $n1 -- the right pattern contents don't matter, but the length does. Left must have the same # of chars in this position and still
                  match the rest of the left side.

                  You could go crazy with this, but this and maybe 1 or 2 more I think would capture the lion's share of what's been asked for. For me, $n1 is what I need:

                  right: file(\w)_(\d+).txt Left: file$1_$n2.txt

                  Incidentally, I'd also recommend you allow "($1)" in the left for cases where the next left pattern char is ambiguous. For instance, I could have used the above patterns:
                  right: file(\w_)1234.txt Left: file$15678.txt

                  In this case, $15 is ambiguous, unless there's a hard limit of 9 replacement tokens. But if left could be file($1)5678.txt, we're all good.

                  Thanks very much for the tool, it's a great one!

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16017

                    #54
                    Thanks for the feedback. Our Alignment Overrides don't currently support defining a mask to 'hide' the different text, but it's on our wishlist to enhance this behavior. I'll add your notes to our wishlist entry on the subject.

                    With the current feature set, any different text in the Replace With section would need to be explicitly defined and does not support a mask.
                    Aaron P Scooter Software

                    Comment

                    • Dill
                      New User
                      • Jun 2016
                      • 1

                      #55
                      Im looking for a solution to compare files like this.

                      on the left side:

                      foo.c
                      foo.h
                      foo_.h
                      foo_banana.c
                      foo_apple.c

                      on the right side:

                      bar.c
                      bar.h
                      bar_.h
                      bar_banana.c
                      bar_apple.c

                      Comment

                      • Zoë
                        Team Scooter
                        • Oct 2007
                        • 2666

                        #56
                        Hi Dill,

                        You can do that by defining an override that uses "foo*" as the "Align left file" and "bar*" as the "with right file", leaving the "Regular Expression" checkbox unchecked.
                        Zoë P Scooter Software

                        Comment

                        • joblini
                          Visitor
                          • Feb 2006
                          • 6

                          #57
                          In BC Pro Version 4.2.2, is it possible to match versioned filenames?

                          In BC Pro Version 4.2.2, is it possible to ignore version information when matching filenames? For example :

                          myapp-1.0.0.ear=myapp-1.0.1.ear.

                          After reviewing the posts in this thread, it seems that it is not possible and has been relegated to a "wish-list".
                          https://www.scootersoftware.com/vbul...1666#post51666

                          My company is considering an upgrade, and this is one of the features we are interested in.
                          Is there a timeline for implementation of this feature?
                          Last edited by joblini; 31-Aug-2017, 08:43 AM. Reason: Clarification.

                          Comment

                          • Aaron
                            Team Scooter
                            • Oct 2007
                            • 16017

                            #58
                            Hello,

                            The Alignment Override supports specific different text, so if the version number is known, you can define it as:
                            *1.0.0.* = *1.0.1.*

                            This would cause any files matching the pattern of your example to align. The thread you found is specific for defining the equal mask and also masking the different text (to help with arbitrary version numbers), which we don't currently support.
                            Aaron P Scooter Software

                            Comment

                            • joblini
                              Visitor
                              • Feb 2006
                              • 6

                              #59
                              Yes, I am specifically asking about arbitrary version numbers.

                              It is not practical to redefine the patterns when the versions change, since we have many different artifacts with version numbers that constantly evolve. In many cases the version numbers also include timestamp information, for example, 1.0.1-SNAPSHOT.20170101235959.
                              We use Maven to generate versioned artifcats, so I imagine that we are not alone in needing to compare versioned filenames.

                              In your post you mentioned adding support for arbitrary version numbers to a "wishlist".
                              Can you provide a timeline for implementation of this feature?
                              Last edited by joblini; 31-Aug-2017, 09:33 AM.

                              Comment

                              • Aaron
                                Team Scooter
                                • Oct 2007
                                • 16017

                                #60
                                We have a wishlist of customer requests. They do not have a specific timeline, but is a list that developers visit for ideas for future features and enhancements. Arbitrary character handling in the Alignment Override is a nice feature to tackle, but is also a pretty big enhancement and not likely one we'll be able to tackle soon.
                                Aaron P Scooter Software

                                Comment

                                Working...