Ignore newlines in Synchronize Dirs

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

User avatar
lbrozovsky
Junior Member
Junior Member
Posts: 2
Joined: 2008-08-21, 09:57 UTC
Contact:

Ignore newlines in Synchronize Dirs

Post by *lbrozovsky »

Make it possible (by checkbox) to ignore different styles of newlines in Commands/Synchronize Dirs...
User avatar
karlchen
Power Member
Power Member
Posts: 4602
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Re: Ignore newlines in Synchronize Dirs

Post by *karlchen »

Hello, lbrozovsky.
lbrozovsky wrote:Make it possible (by checkbox) to ignore different styles of newlines in Commands/Synchronize Dirs...
Hm, and why should this be necessary? How could a "Synchronize Dirs" hold different styles of newlines? :?
Care to explain perhaps? I do not understand.

Karl
User avatar
lbrozovsky
Junior Member
Junior Member
Posts: 2
Joined: 2008-08-21, 09:57 UTC
Contact:

Re: Ignore newlines in Synchronize Dirs

Post by *lbrozovsky »

Hi, well there are situations where a directory tree travels through several different systems (e.g. CVS + multiple OS) and during that process newline styles might get altered (crlf <-> lf). Nevertheless I would like to use the "Synchronize Dirs" command with a "Ignore newline styles" checkbox enabled to see the list of real file modifications.

In the current version I get the list of for example 1000 "modified" files from which 980 are found as modified just because newline styles are altered there. But what I need is the list of those 20 files which are really internally modified.
User avatar
karlchen
Power Member
Power Member
Posts: 4602
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, lbrozovsky.

Now I see. Thanks for elaborating the problem. :)

The difference really is CR vs LF vs CRLF (Mac / Unix / Windows textfiles) inside pure text files only. The filesizes will differ by 1 byte / line because e.g. LF is just 1 byte whereas CRLF are 2 bytes. Therefore TotalCommander will identify those text files as different.

Telling from a quick synchronize test over FTP (Synchronize folders: Windows <=> Unix), the "Compare by content" option is unavailable. But doing a compare by content would be the only way for T.C. to find out which text files only differ in LF vs CRLF.

I do not know whether there is a good solution to this issue using T.C. alone. Personally I hardly ever encounter this issue, because on the Windows machine I save text files which will be used on Unix machines in the Unix text format. (Transfer mode: binary)

Maybe someone else knows how to make the Synchronize Folders function do what you need.

Kind regards,
Karl
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

WinMerge can ignore line breaks, check Edit => Options => Compare => Ignore carriage return differences...

Set left and right directory, then execute that:

Code: Select all

Command: %ProgramFiles%\WinMerge\WinMergeU.exe
Parameter: /x /s /r /e %p%n %t%m
Icfu
This account is for sale
bandita137
Junior Member
Junior Member
Posts: 3
Joined: 2010-11-19, 05:46 UTC

Re: Ignore newlines in Synchronize Dirs

Post by *bandita137 »

lbrozovsky wrote:Make it possible (by checkbox) to ignore different styles of newlines in Commands/Synchronize Dirs...
I'd love this functionality - as there's already a compare by content, it should not be extremely hard to implement it, as file content comparison already displays "0 differences" in such cases.

My setup: I'm using SVN on windows, but sometimes I get modified sources on a linux samba drive - there it comes handy.
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Re: Ignore newlines in Synchronize Dirs

Post by *wanderer »

lbrozovsky wrote:Make it possible (by checkbox) to ignore different styles of newlines in Commands/Synchronize Dirs...
Not very often but i've faced this issue too. Indeed it would be useful and it does not seem that difficult to implement when comparing files as "text".
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Make it possible (by checkbox) to ignore different styles of newlines in Commands/Synchronize Dirs...
This is already supported, just use the compare plugin by clicking on the >> button behind the "By content" checkbox. Then you can enable it and choose the filters (e.g. *.txt *.htm *.html) and the content plugin (internal tc plugin contains a text comparison tool).
Author of Total Commander
https://www.ghisler.com
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

ghisler(Author) wrote:This is already supported, just use the compare plugin by clicking on the >> button behind the "By content" checkbox.
Indeed but not in the most convenient way. For me, it could be seen only as a temporary workaround. What you say, kind of diminishes the purpose of the "compare contents" tool. Personally, i still think lbrozovsky's request is a useful one.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I don't understand your reply. What doesn't work this way?
Author of Total Commander
https://www.ghisler.com
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

ghisler(Author) wrote:Sorry, I don't understand your reply. What doesn't work this way?
That the current process to enable the "ignore different newlines" is awkward and different from every other option of the SyncTool.

That the plugin element of the SyncTool doesn't really make sense, since one would expect it to be available to the CompareTool and not a single person has been inclined to write an additional plugin for the SyncTool - not even the programs Author.

That the [tc.compare as text] isn't named according to it's function, and if it was an actual "plugin" would be available to be used for any filter. And it's not available for use in a normal filter as it doesn't function like any other filter plugin.

That filters are "available" to the SyncTool only if you want to enable that single [tc.compare as text] "plugin", and otherwise every other single filter you try to add is ignored for filtering what files should actually be compared.

That the whole process is completely inconsistent with the compareTool, and previous usage of the filters in any other place in TC.

That there is no option/button/way to display or not display the files (within the compareTool) that wind up being matches as "TXT=". It gets grouped globally into the general "[ = ]" button.

Or maybe wanderer isn't saying that, perhaps I'm just reading between the newlines.
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

ghisler(Author) wrote:Sorry, I don't understand your reply. What doesn't work this way?
Balderstrom wrote:one would expect it to be available to the CompareTool
I think this is very close to what i mean. One may see that two files he expects to be the same, have different sizes. The first instinct would be to use the "file comparison" tool, not the "sync dirs" tool. It just seems a little awkward (as Balderstrom points out) to go that way, kind of a "workaround" for a missing functionality. It's not that it doesn't work, it's just awkward.

Would it cause any problems/difficulties if such a functionality was added in the "file comparison" tool (perhaps in Edit mode)?
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
bandita137
Junior Member
Junior Member
Posts: 3
Joined: 2010-11-19, 05:46 UTC

Post by *bandita137 »

ghisler: It's great! I did not notice this feature in the change list and I was using 7.50 which did not contain it (or I did not see it there).

The only problem I noticed is that it does not work when one of the dirs is a temporary dir (a dir inside a 7zip file).

It's really not as straightforward as clicking an "ignore new lines" box, but for me it does not matter and this solution has more possibilities.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The reason why I implemented it this way: I'm getting requests from people who want that the compare tool ignores some lines at the beginning, or a release date within the file, or tabstops etc. With this plugin solution (and my sample plugin), it's quite easy to add such special wishes.
Author of Total Commander
https://www.ghisler.com
como
Junior Member
Junior Member
Posts: 2
Joined: 2015-03-10, 10:39 UTC
Location: Bulgaria

Post by *como »

@ghisler, Thank you, but is it possible for me to describe step-by-step how to implement ignoring crlf/lf differences?
For now I'm starting "Synchronize directories", then click on ">>" button, then press "Add" button, then enter file filter and press "Define" button. Here press "Plugins tab".

Please help what to enter here, to make possible ignoring crlf/lf differences!
Post Reply