Error message when using forbidden characters in filenames

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

Moderators: sheep, Hacker, Stefan2, white

Post Reply
misvin
Junior Member
Junior Member
Posts: 75
Joined: 2010-08-14, 11:25 UTC

Error message when using forbidden characters in filenames

Post by *misvin »

Hello,

When a user want to rename a file and try to use characters not allowed in file names (like : / \ etc.), Total Commander returns the following error message:
Error: Cannot write <filename>!
Please remove the write protection!

I suggest to replace this error by more suitable message in this situation like Windows Explorer do it:
"A file name can't contain any of the following characters: \ /..."

Also I suggest to change Total Commander behavior to Windows Explorer: prevent inserting illegal characters instead of error message pop-up.

There are cases when a user has inputted a long filename with one illegal character. Total Commander displays the error and clear all text in the filename, and the user need to type all characters in the filename again.

I have described only one case (file rename). But there are many other cases.
For example, create a new directory. Total Commander displays the error:

Directory <name> not created!
OK___________As Administrator

But Administrator also can't use forbidden characters in directory names :D

Related posts:
https://www.ghisler.ch/board/viewtopic.php?t=47124
https://www.ghisler.ch/board/viewtopic.php?t=38733
https://www.ghisler.ch/board/viewtopic.php?p=121725
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 39940
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Not confirmed. If I change a file name from e.g. test.txt to te\st.txt, TC creates folder "te" and moves the file inside name "st.txt". You get access denied if TC cannot create the folder.
Author of Total Commander
http://www.ghisler.com
misvin
Junior Member
Junior Member
Posts: 75
Joined: 2010-08-14, 11:25 UTC

Post by *misvin »

ghisler(Author) wrote:Not confirmed. If I change a file name from e.g. test.txt to te\st.txt, TC creates folder "te" and moves the file inside name "st.txt". You get access denied if TC cannot create the folder.
Please try to change a file name from test.txt to te:st.txt or te"st.txt or te<st.txt or te>st.txt or te|st.txt

BTW, when I change test.txt to te?st.txt, TC renames the file to tesst.txt

About using backslash in file names: this is a nice feature :-) if I need to create a folder tree. I suggest to describe it in the Help file.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 39940
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Ah, yes, you are right for te"st.txt and others. The problem is that I just get an access denied error from Windows, but not the reason of it.

The ? and * are wildcards - ? stands for a single character, * for multiple characters.
Author of Total Commander
http://www.ghisler.com
misvin
Junior Member
Junior Member
Posts: 75
Joined: 2010-08-14, 11:25 UTC

Post by *misvin »

ghisler(Author) wrote:The problem is that I just get an access denied error from Windows, but not the reason of it.
Can you prevent inserting illegal characters in the "real time" mode when a user inputs a file/directory name (like Windows Explorer behavior)?
tiberius_net
New Member
New Member
Posts: 0
Joined: 2020-04-17, 09:25 UTC

Re:

Post by *tiberius_net »

misvin wrote:
2017-11-13, 15:26 UTC
ghisler(Author) wrote:The problem is that I just get an access denied error from Windows, but not the reason of it.
Can you prevent inserting illegal characters in the "real time" mode when a user inputs a file/directory name (like Windows Explorer behavior)?
this is also something that I think should be featured in the TC.
https://devblogs.microsoft.com/oldnewthing/20110110-00/?p=11793
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 39940
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Error message when using forbidden characters in filenames

Post by *ghisler(Author) »

That's indeed a nice feature. But how do I determine the forbidden characters for a specific file system? For example, Apple devices and Linux PCs allow more characters than Windows.
Author of Total Commander
http://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 7280
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Error message when using forbidden characters in filenames

Post by *Dalai »

2tiberius_net,
2ghisler(Author)
At first glance, it sounds like a good idea. However, there is one flaw when removing forbidden characters completely from a filename. What if the user wants or needs to replace (certain) forbidden characters with another character like space or underscore, or any other valid character, maybe even on a case-by-case basis? If TC filters them out, there's no way of knowing where the forbidden characters were once the name is pasted (and forbidden characters stripped). If TC would provide an interactive way to set the replacement character(s), or maybe disabling the stripping of invalid characters, it would be OK.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups
User avatar
Usher
Power Member
Power Member
Posts: 886
Joined: 2011-03-11, 10:11 UTC

Re: Error message when using forbidden characters in filenames

Post by *Usher »

I think the only good solution is to use substitution table.
Regards from Poland
Andrzej P. Wozniak
Post Reply