ignore file extensions in Synchronize directories

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
ITstu
Junior Member
Junior Member
Posts: 3
Joined: 2020-10-26, 06:38 UTC

ignore file extensions in Synchronize directories

Post by *ITstu »

Hi!

Is there a way to ignore file extensions when using the Synchronize directories feature?

My use case is as follows:

left file: abc.txt.m4
right file: abc.txt

I want Total Commander to be able to detect it as the same file (ie. to appear when the Show unequal files and duplicates filters are on).
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: ignore file extensions in Synchronize directories

Post by *gdpr deleted 6 »

As far as i know this is not possible. The whole function of TC's sync tool is build around the concept of treating files on the left and right side as (possibly different) incarnations of the same file when they have the same file name (inclusive the same relative path).

What are you actually trying to achieve here with the help of TC's sync tool?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: ignore file extensions in Synchronize directories

Post by *ghisler(Author) »

This isn't possible because it could result in a one-to-many or many-to many match, e.g.
left files: abc.txt.m3 abc.txt.m4 abc.txt.m5
right file: abc.txt
Author of Total Commander
https://www.ghisler.com
ITstu
Junior Member
Junior Member
Posts: 3
Joined: 2020-10-26, 06:38 UTC

Re: ignore file extensions in Synchronize directories

Post by *ITstu »

Hi,

Thanks for the responses.

Basically I have some svn versioned template files (*.c.m4) which I do not work directly on.
I have a separate environment where I work on final versions of these *.c files with the M4 macros expanded (this is more or less basic text substitution but on a complex environment).
After I finish working on these files, I want to synchronize the *.c files with the *.c.m4 files in order to version my work and then run all tests to check that this works for all possible template values.

As a current workaround, I manually select the files to diff. But this is tedious as I have around 20-30 folders with about 50 templates. Depending on the feature I work on, I typically have differences for about 5-10 templates in 3-5 folders. But I've had refactorings with all the files being modified as well :)

By design, it is guaranteed that the left and right will never contain one-to-many or many-to-many. And anyway, if this is really the case, such a TC feature would simply throw an error and that's it.

Is there a way to make this work if one-to-many or many-to-many is guaranteed to never appear? The relative path is the same always, only the file extension is slightly different. It would help me a lot if I could somehow write a custom expression which TC can use to match the filenames.

Another solution, which also works great, is to somehow statically define all the relative paths which I want to match even if the filenames are different. This is OK for me as the files rarely change.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: ignore file extensions in Synchronize directories

Post by *gdpr deleted 6 »

I am not sure i understand you correctly, but it sounds to me like you actually only want to use the sync tool as a convenient "launcher" for a diff tool (such as TC's built-in "Compare by content" feature) to bring select text/code snippets from the .c files over into their respective .m4 file located in a differen folder tree.

Is my belief correct, or am i mistaken?
ITstu
Junior Member
Junior Member
Posts: 3
Joined: 2020-10-26, 06:38 UTC

Re: ignore file extensions in Synchronize directories

Post by *ITstu »

elgonzo wrote: 2020-10-26, 19:42 UTC Is my belief correct, or am i mistaken?
you are 100% correct!

I also discovered this can be done using Beyond Compare's Alignment Override option. There I used a regular expression to align the left m4 file to the right one. Very nice that they support back references (ie. $1 in my example)

https://imgur.com/a/eQPyrO6
https://imgur.com/a/Tub6VWE
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: ignore file extensions in Synchronize directories

Post by *gdpr deleted 6 »

For a moment you had me there. Using \x2e in favour of \. in your regex pattern. Cheeky! 8)
It seems Beyond Compare is a tool that is much better suited to your needs. Put a toolbar button in TC to launch it with the directories from TC's left and right panel, and off you go :)
Post Reply