Special folder for backup files created by Compare&Edit

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Special folder for backup files created by Compare&Edit

Post by *MVV »

I suggest to add new INI option named like 'CompareSaveBackupFolder'. If it is not specified, internal comparer saves backup files as now near modified file. But if CompareSaveBackupFolder points to some folder, internal comparer saves backup files to that folder.

To keep file index (and hard copies) TC needs to copy file with new name %N.bak to make backup (and it does it with CompareSaveOriginal=1) - and it doesn't matter at all where to put backup file (same folder/same drive/any special folder) since it will be always copy operation. But it will be great if TC put backup files into special place for backups and not to leave garbage in source folder (it is not so hard to get backup from special folder when needed).

Also such key will allow TC to work normally if source folder is write-protected but compared and edited file has full permissions since TC won't try to add new file into protected folder, just modify existing one.

And, such option doesn't require localization, just few lines in help file. :)

(I think it was discussed some times but I coudn't find topic)
User avatar
petermad
Power Member
Power Member
Posts: 16117
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Support++
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Dear Christian, will TC users see this feature in TC 8.0?

- It is really uncomfortable to compare-n-edit files if one of them is write-able in write-protected folder - TC asks to save modified file into another folder so it is impossible to save modified file using original name and path so I need to save modified file into some another place and move it to original place after closing comparer.

- During multiple compare-n-edit operations TC leaves backup files in many folders where users don't require them.

So it would be much better to have theese files in one generic user-specified place (e.g. with original folder structure like f:\temp\tc_backups\e$\docs\myfile1.txt.bak or using special filename with masked path like f:\temp\_tc_backups\e$~docs~myfile1.txt.bak).
And, making backup will be even faster if backup folder is on another partition since backup is made by usual copy operation.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Another compare with file in write-protected folder (file has full access rights since it is INI file), and again same problem - I can't edit-and-compare it because TC won't allow to save file because of failed .bak creation....
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's not that easy because .bak files are often created by just renaming the originals when saving - and that must be done on the same drive...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Renaming is bad idea because it breaks hardlinks and permissions, so I think better way is to copy file (there is an option to enable such backup creation already), so it doesn't matter where to copy file...

Also, you need to create a file anyway, and file is already in cache, so saving will be quick. And, filesize for edit-n-compare is not too much...

Maybe you can allow special place for backup-via-copy option only if you like fast backup-via-rename? BTW you can allow to make a backup folder for every drive (e.g. by allowing to use drive letter variable in path like in path to tree file), so move will work for backup-via-rename and copy - for backup-via-copy.

Of course, this option may be disabled by default...
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler,
Please add an option to create BAK files in temp directory for 8.50.

It is a pain to merge files in write-protected folders (wincmd.ini is one of them - I have TC folder write-protected but wincmd.ini may be written by users), every time I try to save file TC requires to save it to other place even if file is writable.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This is unfortunately impossible - TC opens files for file mapping, so it needs to rename the file on the same drive.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It is quite easy in the mode when TC creates backup by copying. It won't take more time to save file to temporary folder anyway (same drive - same time, another drive - maybe even less time). And, it is really unlogical to save file into another folder just because temporary file can't be created in this folder...

I think many people use this mode (it is the default mode, CompareSaveOriginal=1). It keeps original file streams/permissions/hardlinks etc...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

There is still the problem that the two files often have the same name, so the .bak files couldn't go to the same directory.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

But you can assign them any names, why is it a problem? Temporary files may have temporary names. :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The problem is that in case of damage, the user needs to be able to find the backup somehow...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can append prefixes with date-time and left/right specifier (e.g. 2013-07-12 23:45:23:123 R file1.txt where R means initially right comparer side).
Currently when TC deletes temp files after comparison user can't recover backups more so it is the same thing.
Maybe additional flag for CompareDeleteBak key would be nice: 1 - delete, 2 - keep in temp, 3 - keep in temp and delete... Currently I use CompareDeleteBak=1 to get rid of backup files that TC creates everywhere. But with option to save them in temp folder I would use CompareDeleteBak=2 to keep backups in one place w/o instant deletion.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler,
Do you plan to learn TC to keep backups in separate folder? I face with this restriction every time when I compare&edit *.ini in TC dir (where files are read-only except configuration ones): TC suggests to save file to another directory. It would be much better to show dialog to save backup at least but it would be much greater to do it w/o user interaction.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It's on my wish list, but didn't make it into TC yet, sorry...
Author of Total Commander
https://www.ghisler.com
Post Reply