Button for renaming files
Moderators: Hacker, petermad, Stefan2, white
Button for renaming files
hi!
How can I make a button which renames selected file from:
"FILENAME.WAV"
to
"i1_FILENAME.WAV"
I would like to have ie. 9 buttons. Each button to rename selected file to (i1, i2, i3,... i9)
OR
a better solution would be to make a shortcut on keyboard ie. have a selected file and press CTRL+ALT+1 for "i1",...
Thank you for you time.
How can I make a button which renames selected file from:
"FILENAME.WAV"
to
"i1_FILENAME.WAV"
I would like to have ie. 9 buttons. Each button to rename selected file to (i1, i2, i3,... i9)
OR
a better solution would be to make a shortcut on keyboard ie. have a selected file and press CTRL+ALT+1 for "i1",...
Thank you for you time.
Re: Button for renaming files
copy this and paste it into the buttonbar (rightclick - > Paste)
if you want to set a hotkey for this you need to define a usercmd:
Image: https://upright-waste.000webhostapp.com/images/rename_1.png
Image: https://upright-waste.000webhostapp.com/images/rename_2.png
Code: Select all
TOTALCMD#BAR#DATA
%comspec% /c
rename %P%N "i1_%N"
%comspec%
rename [1]
Image: https://upright-waste.000webhostapp.com/images/rename_1.png
Image: https://upright-waste.000webhostapp.com/images/rename_2.png
Re: Button for renaming files
i did like you wrote, but "cmd" blinks and does nothing..
i have a version 8.51.
ty
i have a version 8.51.
ty
Re: Button for renaming files
try /k instead of /c.
it will keep the cmd window open. any errors there?
some unicode characters in the filename?
it will keep the cmd window open. any errors there?
some unicode characters in the filename?
Re: Button for renaming files
the syntex of the ocmmand is incorrect
Re: Button for renaming files
does your button look like this? https://upright-waste.000webhostapp.com/images/rename_3.png
update: totalcmd puts "" around filenames with spaces in it, so you end up with this:
that's why it's not working
update: totalcmd puts "" around filenames with spaces in it, so you end up with this:
Code: Select all
rename d:\Test File with spaces.txt i1_"Test File with spaces.txt"
Re: Button for renaming files
yes it does. exactly.
what should i do. even if i try with file without spaces. its the same.
UPDATE!
sorry.. without spaces it works... how can i do workaround to make it work with files with spaces?
what should i do. even if i try with file without spaces. its the same.
UPDATE!
sorry.. without spaces it works... how can i do workaround to make it work with files with spaces?
Re: Button for renaming files
ok... i just added another "" around this (%N):
rename %P%N "i1_"%N""
it does the job
rename %P%N "i1_"%N""
it does the job
Re: Button for renaming files
same with powershell (you can select multiple files with this one):
Code: Select all
TOTALCMD#BAR#DATA
Powershell -NoLogo
Get-Content '%UL' | ForEach {$prefix='i1_'} { Rename-Item -LiteralPath $_ -NewName (-join($prefix,(GI -LiteralPath $_).Name)) }
WCMICONS.DLL,32
rename - i1_
Re: Button for renaming files
Using this function for a while now. it works perfectly and saves me a lot of time
thank you all!
In addition, it happens sometimes that i have to rename it. which means I have to delete first three letters.
Is it possible to scrypt that it deletes the first three letters of a selected file?
Thank you.

In addition, it happens sometimes that i have to rename it. which means I have to delete first three letters.
Is it possible to scrypt that it deletes the first three letters of a selected file?
Thank you.
Re: Button for renaming files
Code: Select all
TOTALCMD#BAR#DATA
Powershell -NoLogo
gc '%UL' | %% {ren -LiteralPath $_ -NewName (((GI -LiteralPath $_).Name).substring(3))}
WCMICONS.DLL,32
remove first 3
Code: Select all
Get-Content '%UL' | ForEach {Rename-Item -LiteralPath $_ -NewName (((GI -LiteralPath $_).Name).substring(3))}
Re: Button for renaming files
This button should also do it - it requires TC 10.00
Code: Select all
TOTALCMD#BAR#DATA
%COMSPEC% /C
rename %P%N "i1_"%N:~3,255""
wcmicons.dll,63
Rename and cut off 3 first charaters
1
-1
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
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
Re: Button for renaming files
PERFECT! I love 10!
FYI... not for this topic.
I don't know why, but in some versions i've found a "bug"... when searching and "find files" was open and i wanted to listen one *.wav file, and then pressed ESC, it closed "lister" and "search window" at the same time (ESC pushed only once)
In this 10.00 version it's corrected. One push ESC - exits only Lister. Second push ESC - exits search window.
I simply couldn't find what was wrong. could it be a bug in previous (x64) versions?
FYI... not for this topic.
I don't know why, but in some versions i've found a "bug"... when searching and "find files" was open and i wanted to listen one *.wav file, and then pressed ESC, it closed "lister" and "search window" at the same time (ESC pushed only once)
In this 10.00 version it's corrected. One push ESC - exits only Lister. Second push ESC - exits search window.
I simply couldn't find what was wrong. could it be a bug in previous (x64) versions?