Copy selected file name without the extension to Clipboard

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Andre Linoge
Junior Member
Junior Member
Posts: 84
Joined: 2004-03-14, 22:22 UTC

Copy selected file name without the extension to Clipboard

Post by *Andre Linoge »

Good day.
We have the option to rename a file, without the ectension.

Is it also possible to select the file without the extension??

TIA
Andre Linoge
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7025
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

No, there is no such option.
What is the reason for this question ?
Andre Linoge
Junior Member
Junior Member
Posts: 84
Joined: 2004-03-14, 22:22 UTC

Post by *Andre Linoge »

Horst.Epp wrote:No, there is no such option.
What is the reason for this question ?
I create html-files for images and i need to replace "name" with the filename therefor i need to remove the extension.
Rather tidious job.

<title>Name</title>
<img src="Name.jpg" alt="">
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7025
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

Andre Linoge wrote:
Horst.Epp wrote:No, there is no such option.
What is the reason for this question ?
I create html-files for images and i need to replace "name" with the filename therefor i need to remove the extension.
Rather tidious job.

<title>Name</title>
<img src="Name.jpg" alt="">
That can be done with the TC Multi Rename function.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Andre Linoge wrote: I create html-files for images and i need to replace "name" with the filename therefor i need to remove the extension.
Rather tidious job.

<title>Name</title>
<img src="Name.jpg" alt="">
How is your work flow?

Do you always work on one single file,
or do you have to get the base name of many files at once?


Test this out, I think that should work:


For one file you can use this button:

Code: Select all

TOTALCMD#BAR#DATA
cmd /c
echo %O | clip
%Commander_Path%\WCMICONS.DLL,7


1
-1

For a few files (up to 50) you can use this button:

Code: Select all

TOTALCMD#BAR#DATA
cmd /c
del %tmp%\tmp && for /F "tokens=*" %%F in ('type %F') do (@echo %%~nF >> %tmp%\tmp) && type %tmp%\tmp | clip
%Commander_Path%\WCMICONS.DLL,7


1
-1
But better we source this out to an batch file and call that batch from the button. (here the last command is executed for every file instead of one time only)


You can also use this commands in usercmd.ini to be able to add keyboard shortcuts.




@Christian .G.:
I think this thread is another request for some more base-name-only commands and parameters, like:
%o = write list with base names of all selected items (like %O)
and
cm_CopyBaseNamesToClip (like cm_CopyNamesToClip)
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

There was a nice trick from user white:

- Select your files.
- Open the Multi Rename Tool.
- Rename Mask:

Code: Select all

#[N]#[N].[E]
- Leave Extension empty.
- Search for:

Code: Select all

#(.*)#(.*)
- Replace with:

Code: Select all

<title>$1</title> <img src="$2" alt="">
- [x] RegEx
- <F10> "Edit names..."
- Copy the result from the editor into your HTML-file.

HTH
Holger
Post Reply