Compare all files in two folders By Contents - ignore specific XML-elements

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Pappap
New Member
New Member
Posts: 1
Joined: 2024-04-09, 10:00 UTC

Compare all files in two folders By Contents - ignore specific XML-elements

Post by *Pappap »

Dear all,

I have two folders containing many xml-files, and I would like to filter out which files that has a different content file to file - but ignoring two specifik XML-elenents.

Example (just a part of the XML):
<mes:Header>
<mes:OriginatingCountry>XX</mes:OriginatingCountry>
<mes:DestinationCountries>YY</mes:DestinationCountries>
<mes:MessageId>XX05060eea3e9cfc812992f3750e018e07</mes:MessageId>
<mes:Timestamp>2024-02-02T16:39:15</mes:Timestamp>
</mes:Header>

It is the value in the elements mes:MessageId and mes:Timestamp i would like to ignore.

I have tried several attempts with input from ChatGPT using the Synchronize Maps-function and adding the Filter in the By Content Plugin.

For filetype i have tried both '*.xml' as well as '*.*'.
Different filters suggested by ChatGPT:
*-<mes:MessageId>*|*-<mes:Timestamp>*
*<*mes:MessageId>*|*<*mes:Timestamp>*

But when compraing, all files is detected as different (the option Ignore Date is checked).

Help would be much appreciated.

Best regards
Peter
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6499
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Compare all files in two folders By Contents - ignore specific XML-elements

Post by *Horst.Epp »

This ChatGPT suggestions are pure nonsense.

There is no Synchronize Maps-function in TC.
To my knowledge, the only TC Content Plugin for comparison is the PCREsearch content plugin
which can be used to Synchronize Dirs, but it's not applicable here.

I have configured Beyond Compare as external compare tool in TC.
It contains a set of pre-defined rules, including XML
Here you can add your strings as unimportant text.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.3 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Compare all files in two folders By Contents - ignore specific XML-elements

Post by *ghisler(Author) »

There is no out of the box solution. You would have to write your own content plugin implementing the function ContentCompareFiles. You can see how this work in my sample plugin:
https://plugins.ghisler.com/content/wdx_filesys_src.zip

Here the ContentCompareFiles function compares two text files while ignoring different types of line breaks (carriage return, line feed, or both). The function can then be used in "synchronize dirs" by checking "by content" and clicking on the button behind it.
Author of Total Commander
https://www.ghisler.com
Post Reply