Same filenames, different folders, different extentions

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Noisia
New Member
New Member
Posts: 1
Joined: 2013-02-17, 14:53 UTC

Same filenames, different folders, different extentions

Post by *Noisia »

Hi there!

Let's say i want to select files with the same name and different extentions in two separate folders, how do i achieve this using TC?

Thanks in advance! :)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You need to copy selected names into clipboard, replace extension in text editor and load modified names from clipboard in another folder. Open command browser (execute in command line or add to buttonbar cm_CommandBrowser) for all commands.
User avatar
petermad
Power Member
Power Member
Posts: 16101
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

You can use the internal command cm_SelectCurrentName but only for files with the same name in the same panel.
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Copy Names without extension to clipboard

Post by *Stefan2 »

MVV wrote:copy selected names into clipboard, replace extension in text editor
I remember we had utilized MUT for this:
- select the files
- open MUT (Ctrl+M)
- set name to [N] and extension to none
- click "Edit names..." to get the list of names without extension


.
User avatar
petermad
Power Member
Power Member
Posts: 16101
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2Noisia

Copy this to clipboard:

Code: Select all

TOTALCMD#BAR#DATA
selectfilest
%O.*
totalcmd.exe,4
Select files with the same name in opposite panel
0
-1
Thereafter right click on the button bar an choose "Paste"
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
j89
New Member
New Member
Posts: 1
Joined: 2016-03-29, 12:07 UTC

Post by *j89 »

petermad wrote:2Noisia

Copy this to clipboard:

Code: Select all

TOTALCMD#BAR#DATA
selectfilest
%O.*
totalcmd.exe,4
Select files with the same name in opposite panel
0
-1
Thereafter right click on the button bar an choose "Paste"
Is it possible to modify this button/script to work with more files at once?
I have selected multiple files, I want to select all the files with same name (different extension) in opposite panel, how should I do that?

Additional question - Is it possible in a similar way to select a filenames with the same beginning? (first 8 characters same, the rest different, various file name lenghts) How?
Stefan2 wrote:
MVV wrote:copy selected names into clipboard, replace extension in text editor
I remember we had utilized MUT for this:
- select the files
- open MUT (Ctrl+M)
- set name to [N] and extension to none
- click "Edit names..." to get the list of names without extension
.
I have tried this method, now I have the list of file names without extension in notepad, but how can I use this list for selecting all files with these names in a different folder?
EDIT: I have figured this one out: save the notepad, Mark->Load selection from file. This method works but having a button for this (similar to the one above) would be much faster.

Thanks for any help, I have never used any of these advanced functions/scripts in TC.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

E.g. you can use such a simple takeFirst8CharsFromNames.bat file for getting list of masks from selected files by first 8 name characters (it is too simple and does't filter duplicates but it works):

Code: Select all

@echo off
title %~n0
if "%~1"=="" echo Parameters: "%%WL" & pause & goto :EOF
set $srcList=%1
set $dstList=%TEMP%\$first8CharsMasks.txt
if exist "%$dstList%" del "%$dstList%"

for /f "usebackq delims=" %%n in (`type "%$srcList%"`) do call :processFile "%%n"
start "" notepad.exe "%$dstList%"
goto :EOF

:processFile
set $name=%~n1
set $name=%$name:~0,8%
echo "%$name%*">>"%$dstList%"
Just create a buttonbar button with path to this file and parameters "%WL" (also enable Minimized option), then select some files and press this button. Notepad will be opened where you can copy all masks and then load selection in TC.


You can also modify it by replacing this line:

Code: Select all

start "" notepad.exe "%$dstList%"
with line:

Code: Select all

clip < "%$dstList%"
in order to copy names to clipboard immediately instead of opening names in notepad.
Post Reply