No announcement yet.

Compare files with partially matching file names?

  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Is realize this is an older post, but after trying to use the ideas presented in the post above by Michael, but found it didn't work for my situation.

    After recreating the example though, it did work, hmmmm...

    I then found if I changed the example elements to:

    alpha-123.txt <--> alpha-12

    It stopped working.

    The added dash seems to interfere with the alignment override even though the pattern (.{7}).*\.(.*) would seem to imply match any / all of the first 7 characters?

    Is this a bug? If not, how do I work around this issue when the file could contain one of more dashes, or other characters that 'trip up' the .{7}? And what is the list of characters that cause this issue?



    • #32

      Your pattern would match any of the first 7 characters, but in order to align, the target/destination must also be a pair and cannot use any masking characters. In this example, 7 characters in would grab a through 1, correct? Does your destination mask include "2"?

      One possible example:

      Aaron P Scooter Software


      • #33
        Apparently I'm confused, so let me re-state

        using the example alignment filter of:


        and the files named

        alpha123 <--> alpha12 matches!

        Change file names to:

        alpha-123 <--> alpha-12 no match!

        First 7 characters are the same in both examples!? But the second one doesn't match. Why?



        • #34

          Assuming the destination filter is matching on $1.$2, adding the - would be matched, but the "2" wouldn't be included in the $1, so it would need to be explicitly defined in the "Right"/Destination side. What "right" expression do you have defined?
          Aaron P Scooter Software


          • #35
            I guess I was hoping I stumbled upon was at least a partial answer to a problem that has plagued me for some time, but after re-reading and re-re-reading all the posts above, I guess what I'm looking for is a partial left-side to partial ride-side matching, which BC doesn't seem not capable of doing at this moment.

            alignment override: (.{7}).*\.txt


            Matches right-side files

            but not:

            Starting with the filename, 'alpha123-name.txt' would be the 'closest' matching name since the first 7 match, but past that, even more of the right-hand name matches ('alpha123-'). To break ties, use date, size and/or rule or binary compare to find a match.

            In general, logically, what I'm looking for is to see if I have *at least* 1 matching file, not that all 6 matching or there are 3 matching and 3 non-matching files.

            By extension, ultimately, I believe that what I/we are looking for is the ability to ignore all or part of the filename/extension -- i.e. content only compares. Currently, I use an old product for this function (Duplica8), but it completely ignores folder structure and there is no left vs right side, which is not always what I want to do.

            I LOVE BC and have personally recommend hundreds of times, but personally the lack of this one feature drives me crazy on almost a daily basis.

            Also, I know I have stated this in another post, but please consider allowing us, the users, to see some version of the 'wish list' and to vote on what we feel most effects us (5 votes max). You can then comment on these items (on the ease or difficultly in implementing it, etc). This doesn't mean a loss of your internal control, but it will let *us* know what others are thinking. Another product I use, used this service (in my opinion, to great effect), but I'm sure there are other services out there...

            Sorry if I'm venting (again...)
            Last edited by markm9999; 19-Jun-2012, 12:14 AM.


            • #36

              All Alignment Overrides exist as two parts. You've mentioned the "left" or source part a couple of times, but I do not see your "right" or destination part.

              The limitation of BC3 is that the Alignment Override's right part does not support mask characters; it only supports the back-reference character ($1, $2, etc) for regular expressions. Since the Left and Right parts of the alignment override must match for those two parts to align, the right must include any text explicitly that is in the right name but not in a back-reference.

              If you defined the first part of your name with a variable, such as .* instead of .{7}, the back reference section could include more text. Since you have defined it to limit it to only the first 7 characters (earlier example of "alpha-1"), this is the text that is used in the $1. Any other text in the right file name must then also be present for it to be a match, which in that case is a "2".

              Aligning on other characteristics, such as a file's contents, is on our wishlist for a future version.
              Aaron P Scooter Software


              • #37

                Regarding what you said about the right-side setting, clicking on the drop-down next to it reveals 'Tab \t', 'Find Expression ($0)', and Tagged Expression 1..9 ($0..9).

                So, I have 2 questions:
                1. Can you confirm that the only special characters/expressions that are allowed in regular expression mode, are those displayed within the left-side or right-side drop-downs.
                2. In normal mode, you can only use * or ?, correct?
                3. What is & how do you use the 'Find Expression $0' within the right-side? I briefly looked around the web, but didn't seem to find any regex reference to this.



                • #38

                  1. I can confirm that the only supported options in the Right side are in the dropdown. The Left Side might support a couple of additional Regular Expression options that I am not aware of.

                  2. "Normal Mode" is a Dos Compatible mask. This is limited to * and ?.

                  3. The Find Expression command would match on the definition of the Left regular expression.

                  Our Alignment Overrides can help match a VeryLongName example to a subset of that name, but if there is any different text in the subset name (a character that does not appear in the original, longer name), you would need to include that character explicitly in the Right definition. If you have a specific example you are having trouble with, please post it here and I can help you with the definition necessary to match that pair of file names.
                  Aaron P Scooter Software


                  • #39
                    compare filenames partly

                    I continue within this thread, as it's well established...
                    Originally posted by Aaron View Post
                    ...If you could post an example set of files you would like to align, it would be helpful in determining a RegEx to use.
                    I would like compare filenames like
                    String1 - String2 - String3.ext
                    where the comparison should only take String1 & String2 into account.
                    The length of the strings can vary, but the "-" is common in all files.
                    The file extension doesn't matter for me, as long as "String1 - String2" are correctly compared while disregarding String3.

                    Any ideas, please?
                    Thank you


                    • #40

                      The Alignment Overrides do not currently allow a section to be disregarded. At it's most basic, you would define:
                      FullFileName.txt = OtherFullFileName.txt

                      Where masking can be used allows users to match variable parts of the file name that are equal on both sides, such as
                      NameA.jpg = NameB.jpg
                      NombreA.jpg = NombreB.jpg

                      *a.jpg = *B.jpg (or a similar Regular Expression). The "Name" changes, but is equal on the left and right.

                      Regular Expressions can be used to match on text that is equal, and if text is missing, this can be worked around, but if String3 is variable and different on both sides, you would need to define it in the source and target. Since the target side does not support full RegEx phrases, it usually needs to be explicitly defined.
                      Aaron P Scooter Software


                      • #41

                        Hi All,

                        Could anyone tell me how to get these done:

                        I have song files name as "Singer Name-Song Name xxxxxx", such as:

                        Dave-Songname v2222.mpg
                        Dave-Songname v3333.mpg


                        Patrick-Songname v555.mpg
                        Patrick-Songname v111.mpg

                        How can I just make them align regardless of the letters after the song name? Singer name and song name could be random long.



                        • #42
                          Hi there,

                          I'm in need of the exact same feature as pointed by Mk16. In fact, i purchased bc4 because i read in other forum that it'd be able to do it. Apparently it isn't possible, though.

                          So, i was wondering if there's any chance we get this feature implemented in BC4?

                          I.e. I'd love being able to do this:


                          • #43

                            This is on our wish list for a future version, but not supported in the current version of BC.
                            Chris K Scooter Software


                            • #44
                              Hi all,

                              Similar challenge here. I'm trying to compare files with the same file name but different extensions between a local folder and an SFTP server. For some reason the files won't match, as per -

                              Click image for larger version

Name:	compare1.jpg
Views:	2
Size:	95.9 KB
ID:	76267

                              My session comparison settings are set thus-

                              Click image for larger version

Name:	compare2.jpg
Views:	2
Size:	96.6 KB
ID:	76268

                              Any idea why the files aren't matching? I've tried adding an alignment override for .zip and .png and that doesn't seem to be doing it either.


                              • #45
                                Thanks for the report. The option does not currently work for archives (even when they are Always Treated As Files), but we're looking into fixing this and introducing this behavior.

                                Update: I should clarify: between files and archives. As a workaround in the meantime, you could remove the .zip association in the Options dialog, which would cause them to always be files and only files. Changing this option does require restarting the program.
                                Aaron P Scooter Software