Compare files with partially matching file names?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arjaydavis
    Expert
    • Oct 2010
    • 53

    Compare files with partially matching file names?

    Is it possible to enable Beyond Compare to partially compare files with partially matching file names?

    I ask this because, after burning DVD backups of my files, some of the files with longer filenames on the disk are truncated to within ISO standards which means direct comparison with their equivalents on hard disk is not easy, unless manually using the "Compare to" option.
  • Aaron
    Team Scooter
    • Oct 2007
    • 15941

    #2
    Hello,

    In BC3 Pro you can setup an Alignment Override that will match on a specific pattern. This would be difficult to setup in your truncation case since any different text between the matches must be explicitly defined.

    If you would like to test it out and you are running Std, please see this guide:
    http://www.scootersoftware.com/suppo...?zz=kb_evalpro
    Aaron P Scooter Software

    Comment

    • Michael Bulgrien
      Carpal Tunnel
      • Oct 2007
      • 1772

      #3
      Originally posted by Aaron
      This would be difficult to setup in your truncation case since any different text between the matches must be explicitly defined.
      Actually, an Alignment Override rule does not necessarily need to have different text explicitly defined for a truncation case. For example, the following alignment rule:

      Align Left File: (.{7}).*\.txt
      with right file: $1.txt

      Will correctly align these files on the left:
      alpha123.txt
      beta123.txt
      delta123.txt
      epsilon123.txt
      gamma123.txt

      With these files on the right:
      alpha12.txt
      beta123.txt
      delta12.txt
      epsilon.txt
      gamma12.txt

      Even though characters have been truncated from the file names.
      BC v4.0.7 build 19761
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15941

        #4
        Thanks for the example, Michael. I hope the above is helpful. It is a good example a truncated filenames.

        If they have other patterns, such as GammaLongName.txt and GammaNotShortName.txt to gamma~1.txt or gamma~2.txt, it could be a bit trickier. If you could post an example set of files you would like to align, it would be helpful in determining a RegEx to use.
        Aaron P Scooter Software

        Comment

        • arjaydavis
          Expert
          • Oct 2010
          • 53

          #5
          @Michael Bulgrien - brilliant, this is what I'm looking for.

          @Aaron - to give you an example you requested for @Michael Bulgrien's solution, it would be a email file with the subject, sender and recipient as the filename, which would be long, but truncated by the DVD burning tool to conform to ISO length standards. For example a file name could be
          • [email protected], Aaron@beyond compare email.com, Compare files with partially matching file names.eml


          truncated to:
          • [email protected], Aaron@beyond compare email.com, Compare files with partially match.eml


          I don't know the exact length at which the truncation occurs but this example should illustrate, applying @Michael Bulgrien's solution should make this comparison work I would hope. Thanks.

          Originally posted by Aaron
          Thanks for the example, Michael. I hope the above is helpful. It is a good example a truncated filenames.

          If they have other patterns, such as GammaLongName.txt and GammaNotShortName.txt to gamma~1.txt or gamma~2.txt, it could be a bit trickier. If you could post an example set of files you would like to align, it would be helpful in determining a RegEx to use.

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15941

            #6
            Hello,

            Well, with the example above, it looks like Michael's suggestion should work perfectly. From my own experience with ISO truncation, it was always much more extreme, but that doesn't seem to be your case.

            If you have any questions on Alignment Overrides, and it isn't behaving as you expect, please just let us know. As a Session Setting, you will want to save a Session with it set for future use, or set it as a Session Default.
            Aaron P Scooter Software

            Comment

            • Michael Bulgrien
              Carpal Tunnel
              • Oct 2007
              • 1772

              #7
              Let me add that if your file extensions differ, then the following might prove useful so long as your file names don't include a period in the actual filename as well as between the filename and extention:

              Align Left File: (.{7}).*\.(.*)
              with right file: $1.$2

              Each set of parenthesis creates a back reference. $1 returns the captured text from the first back-reference, $2 from the second, etc.
              BC v4.0.7 build 19761
              ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

              Comment

              • arjaydavis
                Expert
                • Oct 2010
                • 53

                #8
                Originally posted by Aaron
                If you have any questions on Alignment Overrides, and it isn't behaving as you expect, please just let us know. As a Session Setting, you will want to save a Session with it set for future use, or set it as a Session Default.
                I would love to see an alignment precedence feature whereby you could align first by filesize then filename, then date, then folder. As at the moment, beyondcompare sometimes chooses the not the files I want to compare when using the flattened system. For example it compares on left file1.txt 1234 bytes with file1.txt 4567 bytes on right but there is also a same file1.txt with 1234 bytes on right. I've already explaned all this and I know it's not a feature yet but sure would like it.

                http://www.scootersoftware.com/vbull...ead.php?t=6815
                Last edited by arjaydavis; 03-Mar-2011, 03:08 AM.

                Comment

                • arjaydavis
                  Expert
                  • Oct 2010
                  • 53

                  #9
                  Originally posted by Michael Bulgrien
                  Let me add that if your file extensions differ, then the following might prove useful so long as your file names don't include a period in the actual filename as well as between the filename and extention:

                  Align Left File: (.{7}).*\.(.*)
                  with right file: $1.$2

                  Each set of parenthesis creates a back reference. $1 returns the captured text from the first back-reference, $2 from the second, etc.
                  Thanks @Michael Bulgrien this will enable me to work with extensions being the same but the name part of the file being truncated.

                  Comment

                  • arjaydavis
                    Expert
                    • Oct 2010
                    • 53

                    #10
                    Tried these suggestions and it doesn't seem to work.

                    I go into Session Settings and Misc and put in the regex and try it both with update this view and update all settings drop down options but I'm still not getting the comparison to happen, i.e. I still see blue folders/files either side indicating that the comparisons didn't match up because the filenames are different.

                    Comment

                    • Aaron
                      Team Scooter
                      • Oct 2007
                      • 15941

                      #11
                      Could you post 2 or 3 specific filename pairs you would like to see aligned? You can post here or email us privately at [email protected]. If you email us, please include a link back to this forum post for reference. A full screen screenshot may help as well.
                      Aaron P Scooter Software

                      Comment

                      • arjaydavis
                        Expert
                        • Oct 2010
                        • 53

                        #12
                        Originally posted by Aaron
                        Could you post 2 or 3 specific filename pairs you would like to see aligned? You can post here or email us privately at [email protected]. If you email us, please include a link back to this forum post for reference. A full screen screenshot may help as well.
                        Can I suggest you confirm that the solutions offered here either do or do not work?

                        @Michael Bulgrien offers a regex and some example filenames to test his solution, here:
                        http://www.scootersoftware.com/vbull...06&postcount=3

                        and here: http://www.scootersoftware.com/vbull...51&postcount=7

                        And I've offered my specific case here:
                        http://www.scootersoftware.com/vbull...36&postcount=5

                        I would think this would be enough for you to recreate my problem and see if the solutions actually work.

                        Comment

                        • Aaron
                          Team Scooter
                          • Oct 2007
                          • 15941

                          #13
                          Michael's solution uses your original examples as a template. The {7} represents matching the first 7 characters.
                          alpha123.txt
                          to
                          alpha12.txt

                          For his first example, slightly modified, to work on your .eml file pair:
                          Left:
                          (.{95}).*\.eml
                          Right:
                          $1.eml
                          (Regular Expression Enabled)

                          Assuming the longer file name is on the left.
                          Aaron P Scooter Software

                          Comment

                          • arjaydavis
                            Expert
                            • Oct 2010
                            • 53

                            #14
                            Here's my situation in more detail:








                            What I'd like is for the solutions offered here to be confirmed as working or not working and if working I'd like the steps taken because it is not clear to me, after doing as advised then what next am I supposed to do? Re-run the compare or what. I've tried different lengths 95, 40, 7. Settings: for this view, "also update session defaults", rules based compare, binary compare.

                            none seem to work

                            and what about the solution...

                            Left:
                            (.{95}).*\.eml
                            Right:
                            $1.eml
                            (Regular Expression Enabled)


                            Presumably the . in the .{95} means any character, but does that include whitespace?

                            Presumably the ( ) in the (.{95}) is the regex grouping which puts the match of the string it finds into $1

                            But what about the .* after the (.{95}) ? if we've already found our match do we need to deal with any other characters?

                            The \. is an escape code to allow the period/fullstop . to be treated literally rather than as a regex operation. But why is this not used in the right hand side?

                            Comment

                            • arjaydavis
                              Expert
                              • Oct 2010
                              • 53

                              #15
                              The other solution would be for me to write a script to truncate, uniquely each filename exceed the UDF1.02 file length limit, before burning to disc so as to be within the limit but with an index appended to maintain uniqueness. This way the files burnt shouldn't be truncated by the burning software as they already comply and therefore will compare indentically with the original source on hard disk.

                              I'll do this as an interim solution and post here. Give and take though - would appreciate someone in ScooterSoftware actually trying the solutions here to see if they actually work!

                              My interim solution is no comfort for the disc I've already burnt of course, comparing it to the non truncated original.

                              Comment

                              Working...