File inaccessible after in-place rename (Shift+F6)

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

Moderators: Hacker, petermad, Stefan2, white

Post Reply
bfu
Junior Member
Junior Member
Posts: 15
Joined: 2009-10-05, 14:17 UTC
Location: Czech Republic

File inaccessible after in-place rename (Shift+F6)

Post by *bfu »

I wanted to test this item in TC's history.txt:
10.11.10 Added: When renaming a file in place (Shift+F6) and the entered name is invalid, show a dialog box where the user can correct the name
So I created a small file with testfile1 filename on my NTFS volume (Windows fixed drive).

Windows XP x86 SP2 on my desktop (fsutil behavior query disable8dot3 = 0):

Shift+F6
testfile1" (double quotes character at the end of string)
Error: Cannot write E:\...\testfile1"! Please remove the write protection!
then Rename/Move to dialog

testfile1 / (space and forward slash characters)
F3 - file not found
F5 - cannot read
Shift+F6 - file can be renamed back
F6 - file moved and its filename corrected to original
F8 - file deleted to Recycle Bin, where it is listed in 8.3 format as TESTFI~1

Windows 7 x64 on my notebook (fsutil behavior query disable8dot3 = 1):

testfile1"
Error: Cannot write E:\...\testfile1"! Please remove the write protection!
NO! Rename/Move to dialog

testfile1 /
NO ACCESS !!! to the file and I cannot get rid of the file even from another Windows instance !

When doing this on ImDisk and/or TrueCrypt file container based volume (regardless of the removable flag) I cannot F3 but succeed in renaming back.

In Windows 7 x64 guest of VMware Workstation I can rename back and I also have the promised Rename/Move to dialog.

I didn't test that further. If anybody knows how to delete such a file, please help ! Thanx
#208434
User avatar
petermad
Power Member
Power Member
Posts: 16031
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

If anybody knows how to delete such a file, please help ! Thanx
Just a longshot - try in a dosbox: del testfile1* or del testfile*
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Renaming "testfile1" to "testfile1 /" in fact really renames the file to "testfile1 ". (The double quotes are only present to delimit the filename.)

This filename confirms to the Windows rules. So all Windows programmes should be able to handle the filename "testfile1 " correctly. But in fact they cannot.

Therefore trailing blanks at the end of a filename should be avoided like hell. As a consequence it would be helpful if T.C. rejected the name or at least displayed a warning that having trailing blanks can be problematic.

A simple del testfile* should be sufficient to get rid of the file as petermad suggested.

<offtopic>
The filename "testfile1 " does not cause any problems on Linux. A simple gedit "testfile1 " works perfectly and a rm "testfile1 " as well. :wink:
</offtopic>

Karl
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC deletes trailing spaces from names, but when the user forces such a name with a slash after the space(s), TC doesn't keep the user from doing it.
Author of Total Commander
https://www.ghisler.com
bfu
Junior Member
Junior Member
Posts: 15
Joined: 2009-10-05, 14:17 UTC
Location: Czech Republic

Post by *bfu »

Hi, first of all, thanks for your replies.
Up to date there is only one problematic system/volume where I cannot rename/delete such a file.
Just starting to think about renaming the file by hex editor :-)
Even from the commandline I get "The system cannot find the file specified" error.

Simply inconsistent behaviour of in-place file rename under different environments seems strange to me. I expected that TC will display "Invalid filename entered - please correct it" edit box in all cases and not write errors or silently doing no filename change.

I have found another joke: try Shift+F5 any file to "filename1 /" (without the quotes) under Windows 7. This created DIRECTORY named "filename1" for me !
#208434
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Try to open command line and execute command:
ren "\\?\C:\Full\Path\To\File.Ext " FileNewName.Ext
(full path with drive letter; name exactly as file has - with spaces etc - just use cm_CopyFullNamesToClip to copy exact name and add prefix \\?\)
This will rename file/folder even if its name contains trailing spaces or dot or name is special (e.g. LPT1, AUX etc). Windows functions usually trim usual filenames but never trim UNC names so you're always able to access file using \\?\ prefix.
bfu
Junior Member
Junior Member
Posts: 15
Joined: 2009-10-05, 14:17 UTC
Location: Czech Republic

Post by *bfu »

Great! This worked (even :-)) for me. Good to know for the future and a nice tip to extend TC's functionality. Thanks
#208434
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

bfu wrote:Simply inconsistent behaviour of in-place file rename under different environments seems strange to me. I expected that TC will display "Invalid filename entered - please correct it" edit box in all cases and not write errors or silently doing no filename change.
You can do similiar things with a command prompt.
Here's an older thread of MVV and myself (from this year):
Post Reply