Overwriting File, when renaming.

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Overwriting File, when renaming.

Post by *Balderstrom »

TC 7.50PB6
Create the following:
-> a_File.txt
Edit the file, enter something like: "1st", Save
Copy & Paste it:
-> Copy of a_File.txt
Edit the Copy, enter something like: "2nd", Save

SHIFT+F6 (Rename) Copy of a_File.txt
to: A_File.txt

Instead of a failure and warning that that file already exists, Total Commander overwrites the old file with the new one.

Note, Editing the files aren't necessary - its only to confirm which file exists after the Rename takes place, which is the file with "2nd"
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, Balderstrom.

I cannot confirm that rename "Copy of a_file.txt" to "a_file.txt" overwrites without a confirmation dialogue. I was asked whether I wished to overwrite a_file.txt with Copy of a_file.txt.

I assume that you have switched off the following setting: Configuration => Options => Miscellaneous => Overwriting files
totalcmd.chm => Configuration - Misc. wrote:Overwriting files: If this option is chosen, you will be asked if you want to overwrite existing files while copying/renaming files.
Kind regards,
Karl
Last edited by karlchen on 2009-07-06, 22:44 UTC, edited 1 time in total.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I don't see how that is the same at all.

You aren't attempting to Copy a file to a location where it already exists by the same name. And this is not the "copy/move/delete" dialog. It's rename single file only: Shift+F6. I.E. F2 in windows.

Theres no reason whatsoever a setting related to copy/move/delete should affect an attempt to rename a single file.
Nor should renaming a file overwrite anything at all.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, Balderstrom.

Moving and renaming are closely related operations, independently of the fact that a lot of users will not realize they are.

E.g. in Unix there is only one command for both operations: mv, which is move in fact. It can be used to move a file to a different location or to rename a file. And mv will overwrite existing files without any confirmation.

Yet, this is Total Commander, not the Unix mv command, I know. Nonetheless the difference between renaming a file and moving it is not bigger on Windows than it is on Unix.

The operations performed by F6 (can be used for moving or for renaming as well as) and by Shift-F6 (in-place-rename) are very similar. (1)

But what is more important, T.C. has always allowed you to rename a file and give it the name of an existing file thus overwriting this second file. But by default T.C. does ask for confirmation before doing so.

I cannot tell why you have not noticed before T.C. 7.50 pb6 that shift-f6 could be used to rename a file in such a way that another file will be overwritten. But I can assure you that previous T.C. versions behave in exactly the same way, e.g. T.C. 7.04a.

And the relevant parameter is Configuration => Options => Miscellaneous => Get confirmation before ... Overwriting files. If the option Get confirmation before ... Overwriting files has been ticked you will be asked before the file is overwritten.

It may be debatable whether having only one single parameter for the different file operations copy / move / rename is really a good idea.
Maybe it would be helpful to have the choice of activating / deactivating the confirmation dialogues for copy / move / rename separately. Having 3 separate options would correspond more to the way how most users will perceive the 3 file operations.

Kind regards,
Karl
--
(1)
  • Copy: duplicates a file to a new location or to the same location, but using a new filename
  • Move: just affects the filename, moves the folder entry holding the filename to a different folder
    If you move on the same disk, then the file content is not touched at all.
    If you move to a different disk, then the move operation is simulated by first copying the file to the new location and then deleting the original file. (So in fact moving from disk A to disk B is not a real move operation, but a combination of copy and delete.)
  • Rename: just affects the filename, modifies the folder entry holding the filename.
    As this is pretty much the same operation as the one performed by a move operation, basically it is possible to overwrite an existing file F by renaming file A to F. Yet, Explorer prevents you from doing so. T.C. does not.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I was testing which character to replace "!" with in folder and filenames, since the exclamation point is unmanageable with any batch file that utilizes DELAYEDEXPANSION.

When I pasted a character into the filename, it was no longer in the clipboard due to a previous file copy/paste, so the Filename didn't change. The file was uppercase A_, and suddenly my other a_ test file disappeared.

And even with [ ] Overwriting Files, unchecked you still get a confirmation pop-up for the same instance - when it deals with Folders.

Likely I had it checked before. New Win2K install, harddrive corruption on my data drive leaving my old .ini files inaccessable. I was getting constant popups for every little file change while getting things sorted so I went thru and changed a number of settings.

Linux mv is not comparable either, *nix file systems are not case insensitive. You would not be able to do this on a Linux system. The closest thing of relevance would be:
mv a_File.txt A_File.txt, which requires you to type both filenames.
Also if "A_File.txt" already existed and you didn't use:
mv --force a_File.txt A_File.txt, then it would prompt you as well.
Unless you were foolish enough to alias mv with --[flags].

Now you could put an alias to mvf mv --force in your shell, but then that is a conscious decision to use overwrite not a set-it-and-forget-it default.l
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I copied two first seen files Twain001.Mtx and Twunk001.MTX from temp folder to temp\$mltwcx, renamed first to Twunk001.MTX - TC asks for rewriting.
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Good morning, MVV.

Confirmed, but only provided that this setting is ticked (activated): Configuration => Options => Miscellaneous => Get confirmation before ... [X] Overwriting files.

This setting will make T.C. display overwrite confirmation dialogues on copy, move and rename operations. If you deactivate this setting, T.C. will overwrite files without asking for a confirmation on copy, move and rename operations.

I tend to agree with Balderstrom that this behaviour will not be expected for rename operations, because most users will not be aware that a rename operation and a move operation are internally more or less the same. Most users will not know and will not care about the internals of the file system. (This is perfectly all right. - Most people will be able to drive their cars without caring too much about the internals of the engine.)

T.C. has always acted like this. Yet, it is debatable whether this single setting should not be split into 3 separate settings. This would reflect how most users will perceive the 3 file operations of copy, move and rename.

Kind regards,
Karl
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

<*nix mv - slightly off the way>

Good morning, Balderstrom.

Whether or not you need to add a --force argument to the mv command depends on the command shell which you use and on the (default) setting of the NOCLOBBER parameter.
I can assure you that our Korn shell will not ask for confirmation too often and will not prevent you from renaming "Copy of a_text.txt" to "a_text.txt", although "a_text.txt" exists in the same folder.
The Linux bash default configuration may be more on the safe side in this respect.

Kind regards,
Karl

</*nix mv - slightly off the way>
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

karlchen wrote:Confirmed, but only provided that this setting is ticked (activated): Configuration => Options => Miscellaneous => Get confirmation before ... [X] Overwriting files.
Of course, I have all confirmations turned on. :) I'm not so crazy to disable it. :roll:
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

[OT]
Good Morning @ 11:30pm *grin* - I tend to forget the time difference to the UK, Germany et al. Been quite a few years since I mudded - since the International LP's were the Best back in the day.
[/OT]

@ Karlchen, yes I can say I'm not familiar with Korn, I may of used it but I really don't recall, compared to say bash, csh or zsh.

@ Mvv, hehe well I'm not crazy either ;) I imagine I have a different usage pattern than you do. I've reenabled [x] Overwriting Files, the rest can stay off for now.

I use a Logitech-MX518 Mouse - which allows me to have CTRL, SHIFT at my thumb... and DELete for the middle mouse button. Also by using AutoHotKey can overcome many of the mouse button restrictions.

I also have a lot of Mounted Drives, and Junctioned Directories. Now while you can send files to the RecycleBin you cannot send folders that are on a mounted drive or in a junctioned directory to the recycle bin. Thus whenever you need to do a folder delete, you have to at least think about it, as it will have to be a SHIFT-Delete or you'll get a popup and it wont work.
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

<ot>
Hi, Balderstrom.

My posts were sent between 7:30 and 7:45 a.m. METDST, i.e. 6:30 and 6:45 UK summertime.
In case you see different timestamps, then you have not yet configured the difference between your timezone and the forum timezone.
It quite looks as if the forum uses US east coast time.

Kind regards,
Karl
</ot>
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, no one (myself included) seems to be able to reproduce this problem, so I have to move this to "will not be changed".
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 »

Config: Misc:
[ ] Overwriting Files

Uncheck the options for Overwriting Files.

Then if you have Files:
A_TEST.Txt
B_TEST.Txt

And you RenameInPlace, or "slow-click" on B_TEST.Txt
and rename it to a_TEST.TXT

Then A_TEST.Txt is deleted, and silently replaced with B_TEST.Txt (that you just renamed to a_TEST.Txt).

The same thing occurs, if you renameInPlace B_TEST.Txt to A_TEST.Txt, A_TEST is deleted and replaced with B_TEST.

I realize as Karlchen has stated, TC is treating RenameInPlace the exact same as a FileMove, and with
[ ] Overwriting Files, option unchecked, allows the Rename to take place with no Warning.

Maybe I am in the minority, I just believe there should be a warning Dialog (at least) when you attempt to renameInPlace FileB to FileA - that doesn't require the []Overwriting Files option to be checked.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed rename and move are the exact same operation, you can even give a different directory in Shift+F6! Therefore when you turn off confirmations for copy+move operations, this will affect renaming too.

But the thread starter wrote that it happened even with confirmations turned ON! So far no one seems to be able to reproduce that...
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 »

I was the Thread starter heh.
I didn't realize it was caused by "[]Overwriting Files" until discussion with Karlchen.
What I did notice mentioned above. It wont do the same with folders. Even with []Overwriting Files (unchecked).
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
Post Reply