Page 1 of 3

Synchronize directories - identical files are shown diferent

Posted: 2009-09-20, 14:42 UTC
by Buczo
This problem is in every version of Total Commander.
When you click synchronize directories and set "by content" option, then when you compare, the identical files have got -> or <- if the modyfication dates are diferent.
If you set also "ignore date" then the diferent files are shwon only as != and there is no -> or <- information.
In my opinion if the files are identical they should by shown as "=" the modyfication dates are no important because the files are identical.

Posted: 2009-09-20, 16:04 UTC
by sqa_wizard
If you set also "ignore date" then the diferent files are shwon only as != and there is no -> or <- information.
Sorry, I cannot reproduce this.
Identical files which differ by date only are shown as such (=) here.

By chance you compare two files which just differ by their used linefeed.
Open the files in an editor and have a look at their format.
You probably will see that one has "DOS" format with CRLF linefeed and the other has "UNIX" format with LF linefeed.

Posted: 2009-09-20, 16:22 UTC
by Buczo
I have written two diferent situations.
1. The two files are identical but the modyfication dates are diferent. If you check "by content" - it shows <- or ->. If you check "ignore date" also - then it is good =.
2. The two files are diferent. If you check "by content" only - it shows good (-> or <-). If you check also "ignore date" it only shows != and you don't know witch is newer (no <- and ->).

So the task is: compare two directories. It should show witch files are equal, and if they are not equal - show witch is newer.
You can't do this. If you check only "by content", then they show identical files as diferent (<- or ->). And if you check also "ignore date", then it isn't show witch of diferent files is newer - it shows only equal or not equal.

Posted: 2009-09-20, 16:38 UTC
by sqa_wizard
Well, you set the "ignore date" option and TC ignores the date as told and YOU have to decide which copy direction is the best for your needs.

Posted: 2009-09-20, 16:42 UTC
by Buczo
OK, I agree. But why two identical files are shown as diferent? I check "by content", so if content is the same it should be = and not <- or ->.

Posted: 2009-09-20, 16:47 UTC
by sqa_wizard
I check "by content", so if content is the same it should be = and not <- or ->.
I agree, but as I said above, that is what TC already does on my system.

Are you sure the files are really identical (content and size) ?

Posted: 2009-09-20, 16:53 UTC
by Buczo
I'm sure the files are identical.
Do this:
1. Create file test.txt (Shift+F4) and write to it text "abcd". Save it.
2. Copy this file to another directory.
3. Open this file and append letter "e", then press backspace to erase letter "e" and save changes.
4. Compare this two directories and check option "by content". The result will be <- or ->. And it should be =. Even the sizes are the same - 4 bytes.

Posted: 2009-09-20, 17:23 UTC
by Hacker
Buczo,
Some time ago I proposed a suboption to
[ ] Ignore date
- [ ] ...when files equal

Would this help?

Roman

Posted: 2009-09-20, 17:40 UTC
by Buczo
I think it should resolve problem. But I think that it would be a unnecessary complication in user interface, so in my opinion better would be compare only content if it is checked "by content". But this is only my opinion.

Posted: 2009-09-20, 18:27 UTC
by MVV
I never had any problems with sync tool.
If I have options 'ignore dates' and 'by content' unchecked, TC suggests to replace older file with newer one.
If I check 'ignore date', TC thinks that files are equal (mark them with '=') when sizes are the same.
If I check only 'by content', TC suggests to replace older files with newer, and compares contents if dates are equal and mark with '=' files with same dates and contents.
When I check both 'by contents' and 'ignore dates', TC compares only contents and shows '!=' for different contents and '=' for equal.

Posted: 2009-09-20, 18:36 UTC
by sqa_wizard
In case of one file is newer than the other, there is no need to compare by content at all.
The newer file will be copied over the older by default.
This rule respects the fact that the newer file has the latest modifications which shall be kept.
... and in fact there is no "compare by content" performed, if one file is newer.

A "compare by content" is only performed if "size + name + date" are the same.

Let me explain:

If "size" differs: obviously there are more bytes at one file
=> content differs for sure
=> no need to compare, files are different

If "name" differs: no file match
=> don't know what to compare
=> no chance to compare

If "date" differs: Newer date means latest file
=> no need to compare, latest file is to be kept always

With option "ignore date" you can override the date check in case the date has been change by mistake.
In this case a "compare by content" is performed if "size + name" are the same.

Posted: 2009-09-20, 18:44 UTC
by Buczo
I'm working on a website. I have got hundrets of files. I chane files on 3 diferent computers. And I use compare option to copy files from one computer to another.
I want to TC compare files form me and show me witch are diferent and witch are newer. Then I manualy compare those files (right click and Compare Left & Right) to be sure that I'm not mistaked.
Usualy I have to compare about 10 files. But when I not check ignore date I've got that all files are diferent (hunderds of files) but trully only 10 is diferent. And this is VERY annoying.

Besides it is obvious to me that it is bug when two files are identical and TC shows that they are diferent. "By content" option should compare contents.

Posted: 2009-09-20, 18:51 UTC
by Buczo
You said:

If "date" differs: Newer date means latest file
=> no need to compare, latest file is to be kept always

IT IS NOT TRUE. The files may have diferent dates but same content. If you check "by conntent" it should compare contents and not dates.

Second. Don't focus on options. Focus on tasks. The task is: compare directories, show identicaly files as =, and if not - show witch is newer. It is the simples task you can imagine, and TC cannot do this.

Posted: 2009-09-20, 18:52 UTC
by MVV
Just check both 'ignore dates' and 'by contents'.

BTW, you may start file comparison by double-clicking on file's line instead of opening context menu and choosing 'compare'.
Buczo wrote:If "date" differs: Newer date means latest file
=> no need to compare, latest file is to be kept always

IT IS NOT TRUE. The files may have diferent dates but same content. If you check "by conntent" it should compare contents and not dates.

Second. Don't focus on options. Focus on tasks. The task is: compare directories, show identicaly files as =, and if not - show witch is newer. It is the simples task you can imagine, and TC cannot do this.
If you want TC to compare contents and not dates, just check both options, as I said.

BTW, if you compare with both options and then start sync, you may choose to replace only older, and TC will keep newer files.

Posted: 2009-09-20, 18:58 UTC
by Buczo
But I want to TC tip me a correct choice, and when I check "ignore date" I've got only !=, and no <- or ->.

Thank you for advice, I didn't know that.