Problem with the parameter "%O" and folders

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
PiotrMPPL
Junior Member
Junior Member
Posts: 60
Joined: 2018-10-26, 07:04 UTC

Problem with the parameter "%O" and folders

Post by *PiotrMPPL »

%O places the current filename without extension into the command line

ex

Test.abc

If the folder name contains a do t(Test.abc), the "%O" parameter truncates the name after the dot (Test).

How do I prevent the "%O" parameter from renaming folders?
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Problem with the parameter "%O" and folders

Post by *Stefan2 »

Hi PiotrMPPL.

the %O-parameter behaves like indented by removing the part after the last dot from an object (file or folder name)

For to show you an solution we should know what you want to do at first place.
Probably you have to call an script which can differentiate between file and folder?




 
PiotrMPPL
Junior Member
Junior Member
Posts: 60
Joined: 2018-10-26, 07:04 UTC

Re: Problem with the parameter "%O" and folders

Post by *PiotrMPPL »

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

Re: Problem with the parameter "%O" and folders

Post by *MVV »

Unfortunately TC functions don't check object type before extracting extension or name w/o extension. I completely agree that there FOLDERS should always have empty extension but FILES may have an extension after last dot in name.

E.g. MRT also cuts extensions from folder names. And internal TC information field [=tc.ext] does it too.

But, what's confusing, TC extension column shows no extension for folders, in brief view folder "extensions" are also shown exactly after names w/o tabulation. Inconsistensy!

Some older posts regarding similar problem:
https://ghisler.ch/board/viewtopic.php?f=3&t=47118
https://ghisler.ch/board/viewtopic.php?f=3&t=47731
https://ghisler.ch/board/viewtopic.php?f=3&t=36445
https://ghisler.ch/board/viewtopic.php?f=3&t=36395

ghisler,
Maybe you could finally add an option to separate folder extensions (and perhaps leave it enabled by default for those who uses that)? I really don't think that many people rely on folder extensions. So if the option is enabled, TC should show folder extensions in all extension columns and separate from name in all places, otherwise it shouldn't.
User avatar
petermad
Power Member
Power Member
Posts: 16034
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Problem with the parameter "%O" and folders

Post by *petermad »

2PiotrMPPL
Stefan2 wrote: 2020-11-11, 09:28 UTC For to show you an solution we should know what you want to do at first place.
I agree - without knowing what you want to accomplish it is difficult to come up with solutions or worarounds
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
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: Problem with the parameter "%O" and folders

Post by *gdpr deleted 6 »

MVV wrote: 2020-11-11, 10:43 UTC Maybe you could finally add an option to separate folder extensions (and perhaps leave it enabled by default for those who uses that)? I really don't think that many people rely on folder extensions. So if the option is enabled, TC should show folder extensions in all extension columns and separate from name in all places, otherwise it shouldn't.
If this new mode of treatment for directory and file names is being implemented, i would prefer this being be a new parameter variables instead of an option, either to represent the the directory full name, file base name combination as well as the respective type-sensitive extension, or as a context switch parameter (which would switch the behavior of %O and %E; think of %X and %x). But it should not be a TC-wide option, because this would effectively lock TC into using only commands/buttons with %O and/or %E that either want the extension segregated from both file and directory names, or that want the extension segregated from file names only. But you wouldn't be able to use both kinds of commands/buttons without changing TC's configuration back and forth. Parameter variables, on the other hand, allows you to have commands/buttons who want to treat file names differently from directory names side by side next to commands/buttons which want to treat both directory and file names the same. And it would even allow you to use both modes of directory/file name treatment in the command line of the same command/button (if so desired).
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Problem with the parameter "%O" and folders

Post by *MVV »

elgonzo,
Do you see many different situations where this setting would matter and you would need different modes? I've never used folder extensions so I only need one mode.

But it sounds nice to add parameters that would allow referring to names and extensions in both modes, also perhaps some WDX fields with same values. I've just thought that it would be nice to refer to WDX fields just from TC buttons...
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: Problem with the parameter "%O" and folders

Post by *gdpr deleted 6 »

2MVV
I didn't think of any situations, nor do i want to speculate about what users are going to do vs. what users are not going to do, because i fear this will just end in an opinionated back-and-forth. I am used and totally fine with the current behavior of %O/%E. And since neither a new configuration option nor new parameter variables would change anything with regard to my TC environment. i am not that much invested into whatever form the implemented feature would take. But it should be without doubt that a "global" configuration setting would be less flexible, than having parameter variables for this purpose that can be used on a case-by-case basis. When comparing or weighing alternative approaches to solve a problem or implement a feature, i usually tend to favour the more flexible one when their advantages/disadvantages are otherwise equivalent.

Having the possiblity to reference WDX properties through parameter variables would be nice indeed. (I guess the source for the WDX property values would then be the file under the cursor; but i have to admit that i haven't put much thought into the practicality of other potentially possible sources such as source/target directory, for example.)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Problem with the parameter "%O" and folders

Post by *MVV »

It is of course better to support both ways but this will require more work, e.g. adding another option to MRT dialog...
Post Reply