Page 1 of 2

Parameter for file name without extension or directory name.

Posted: 2023-05-27, 23:26 UTC
by LonerD
Example for clarification.

We have:
file - Its.my.file.txt
directory - Its.my.directory

And single command:

Code: Select all

[em_7Z_pack]
cmd=%commander_path%\Plugins\arc\7-Zip\7zG.exe
param=a -ad -scsUTF-16LE "%P%O.7z" @%WL
menu=7-Zip: Pack selected files
Expectations for result after compression file or directory:
Its.my.file.7z
Its.my.directory.7z

Reality:
Its.my.7z
Its.my.7z

--------------------
Another Example

Code: Select all

[em_7Z_maxLZMA]
cmd=%commander_path%\Plugins\arc\7-Zip\7zG.exe
param=a "%O.7z" -t7z -mx9 -m0=LZMA -mse -ssw -scsUTF-16LE -y @%WL
menu=7-Zip: Maximum compression LZMA
Expectations:
Its.my.file.7z
Its.my.directory.7z

Reality:
Its.my.file.txt.7z
Its.my.7z

----------------------
One more

Code: Select all

[em_RAR_pack_ms]
cmd=%commander_path%\Plugins\arc\Rar\Rar.exe a -m5 -s -ms -os -cfg- -o+ -ep1 -idcdp -c-
param="%O.rar" %S
menu=RAR: Pack with solid maximum compression
Expectations:
Its.my.file.rar
Its.my.directory.rar

Reality:
Its.my.file.rar
Its.my.rar

--------------------
Suggestion:
Parameter for file name without extension or directory name (considering that directories don't have extension in common sense).

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-27, 23:43 UTC
by Gral

Code: Select all

param=a -ad -scsUTF-16LE "%P%N.7z" @%WL
:?:

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 00:58 UTC
by LonerD
@Gral
If you tried to offer alternative, than it will be like

Code: Select all

a -ad -scsUTF-16LE "%P"%N".7z" @%WL
to avoid problem when names contain spaces.
But it's not solution even close. Because if we compressed several files (@%WL) - than %N return names WITH extensions.

Suggestion for clear file name and clear directory name without cutting or extension.

PS. Added another examples.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 01:11 UTC
by Sir_SiLvA
when your folder is called Its.my.directory and you use the parameter %O then %O = Its.my because you told tc to look for the first point from the right side and only take everything left of the point as a filename.

and for me Its.my.file.txt with

Code: Select all

cmd=%commander_path%\Plugins\arc\7-Zip\7zG.exe
param=a "%O.7z" -t7z -mx9 -m0=LZMA -mse -ssw -scsUTF-16LE -y @%WL
turns it into Its.my.file.7z as expected.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 01:14 UTC
by Sir_SiLvA
LonerD wrote: 2023-05-28, 00:58 UTC @Gral
If you tried to offer alternative, than it will be like

Code: Select all

a -ad -scsUTF-16LE "%P"%N".7z" @%WL
to avoid problem when names contain spaces.
But it's not solution even close. Because if we compressed several files (@%WL) - than %N return names WITH extensions.

Suggestion for clear file name and clear directory name without cutting or extension.

PS. Added another examples.
when you want no cutting then why use %O in the firstplace?

ps: if you want no cutting of the filename dont use . in directory name but instead _

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 01:54 UTC
by LonerD
Sir_SiLvA wrote: 2023-05-28, 01:14 UTC dont use . in directory name but instead _
You suggest to rename ALL directories on ALL computers and on ALL disks where I run Total Commander ? :shock: :o
Sir_SiLvA wrote: 2023-05-28, 01:14 UTCwhen you want no cutting then why use %O in the firstplace?
Because TC doesn't have another more suitable parameters :!:
That's why this topic was created - suggestion for new parameter like %O or %N, but with clear uncut name and without extension.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 08:00 UTC
by Fla$her
%O for file and %Q%N for folder in one parameter.
Support++

2LonerD
Haven't you made a mistake anywhere? Some results look unpredictable.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 14:13 UTC
by petermad
%O for file and %Q%N for folder in one parameter.
%Q is already used for other purpose:
Help wrote:%Q Turn off automatic quotation marks around certain parameters like %P%N when the name contains a space. The user will then have to place them by himself.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 14:26 UTC
by Fla$her
petermad wrote: 2023-05-28, 14:13 UTC
%O for file and %Q%N for folder in one parameter.
%Q is already used for other purpose:
I want to remind you that %Q was added at my request.
Where do you see in my sentence that I propose to apply %Q for something else? Don't confuse.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 14:32 UTC
by petermad
2Fla$her
Where do you see in my proposal that I propose to apply %Q for something else?
Then please explain what you mean by:
%O for file and %Q%N for folder in one parameter.
Support++

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 14:35 UTC
by petermad
I suggest a new parameter %ON

The description should be:
%ON works as %O for files and as %N for directories.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 14:51 UTC
by Fla$her
petermad wrote: 2023-05-28, 14:32 UTC Then please explain what you mean by:
I wrote "in one parameter". I didn't suggest a name.
Let it be %o, which will return the result as %O for a file or %Q%N for a folder.

%O doesn't return quotes, because it is often used in a construct with suffixes like .ext.
So, for consistency and convenience for the folder, it's logical to return a value similar to %Q%N, and not %N.
It was mentioned above.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 15:25 UTC
by petermad
2Fla$her
Just to be clear - what you meant, written in a comlete sentence including a verb was:

"Support++ for a new parameter that works like %O for files and like %Q%N for folders."

See, I read your telegram style post, as if you wanted a new modifier parameter (%Q) that would make %N work as %O for folders - my mistake.


%O doesn't return quotes, because it is often used in a construct with suffixes like .ext.
So, for consistency and convenience for the folder, it's logical to return a value similar to %Q%N, and not %N.
Sure - so let me change my proposal to:
I suggest a new parameter %ON

The description should be:
%ON works as %O for files and as %N for directories without auto-quotes.

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 16:07 UTC
by Fla$her
petermad wrote: 2023-05-28, 15:25 UTC Just to be clear - what you meant, written in a comlete sentence including a verb was:
It was a concise name of the request, there was no need for any verb. ;)

Re: Parameter for file name without extension or directory name.

Posted: 2023-05-28, 18:01 UTC
by Sir_SiLvA
petermad wrote: 2023-05-28, 15:25 UTC Sure - so let me change my proposal to:
I suggest a new parameter %ON

The description should be:
%ON woks as %O for files and as %N for directories without auto-quotes.
That seems like a point at which it would be better to get finally some script support
for the name field like >[file:%N|dir:%A] to achive what petermad described.