Disable creation of .bak files with compare?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
jpbosk
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-23, 11:06 UTC

Disable creation of .bak files with compare?

Post by *jpbosk »

Hello,

Is there any way to disable the automatic creation of .bak files when using the Edit mode in the Compare by content function?

Thanks,
jpbosk
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Hello jpbosk,
wincmd.ini
[Configuration]

Code: Select all

CompareSaveOriginal=1
1: When saving, the file is copied to filename.bak, then the data is written to filename. Advantage: additional streams, special attributes etc. are preserved.

0: When saving, the data is written to filename.tmp, then the file is renamed to filename.bak, and finally filename.tmp is renamed to filename. Advantage: The file has to be written only once, and remains intact in case of a write error.
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
jpbosk
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-23, 11:06 UTC

Post by *jpbosk »

Well, if I read correctly there will be a .bak created in both ways?
1: When saving, the file is copied to filename.bak, then the data is written to filename. Advantage: additional streams, special attributes etc. are preserved.

0: When saving, the data is written to filename.tmp, then the file is renamed to filename.bak, and finally filename.tmp is renamed to filename. Advantage: The file has to be written only once, and remains intact in case of a write error.
I'm looking for a way to get rid of those .bak files :-)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50934
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

No, you cannot get rid of them, sorry. While editing (and repeated saving), they are needed as a base for undo operations. They are also kept for the case of data loss.
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 »

Except as is, it causes data loss - as it will overwrite a pre-existing .bak file that has nothing to do with TC's CompareTool.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
MVV
Power Member
Power Member
Posts: 8713
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

So we need separate place for such backup files again. :D
jpbosk
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-23, 11:06 UTC

Post by *jpbosk »

Is it possible to create an extra setting for CompareSaveOriginal in wincmd.ini? Like:

Code: Select all

2: When saving, the data is written to filename and no backup or temporary files are created. Advantage: no backup files and no temporary files. Disadvantage: no backup, no undo, use with care, only for power users, no warranty, possible data loss!
I'm using this feature sometimes to compare code files with are already under SVN version control. So, in case of an error, I don't really care about the data loss, I will get it from SVN again (would be nice if I was warned by Total Commander when something goes wrong of course :))
green_fr
New Member
New Member
Posts: 1
Joined: 2012-02-23, 08:26 UTC

Post by *green_fr »

I think this request was not treated yet — is it still not possible to disable .bak files creating ?
User avatar
MVV
Power Member
Power Member
Posts: 8713
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

green_fr wrote:I think this request was not treated yet — is it still not possible to disable .bak files creating ?
Currently the only thing you can do is to tell TC to remove backup files after comparing. You need TC8 and [Configuration] CompareDeleteBak=1 parameter. But anyway TC creates backup files near original ones.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50934
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The .bak files are necessary because in some cases, TC maps the file into memory to get the unchanged lines. When the user saves the file, the original lines would be lost, therefore TC will then map the .bak file into memory. The old lines are necessary for the editor to use the "Undo" function. That's why the compare tool can only delete the .bak files when closing, because the original lines are no longer needed then.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8713
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It would be perfect to create backup files in temp folder as it was suggested many times, there are a lot of reasons (no problems with write-protected folders when only specific files are writeable; no garbage is created in working directories; no need to have CompareDeleteBak=1 because one may want to access backup files after closing compare dialog - they may be accessed from temp folder then).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50934
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The problem is that when you have multiple drives, the TEMP folder may be on a different drive, which could cause many new problems.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8713
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Christian, I can't see any problem here. Anyway you will need to copy file in order to create backup, so it doesn't matter where to place this copy. So it won't slow process down if temp folder is on another volume. Really it may even improve backup creation speed e.g. if compared file is in network or on slow drive while temp folder is usually on fast drive (you may even provide an option to set folder for such backup files and use some default one like %TEMP%\_tc_bak).
Post Reply