this is example repetitive stucture folder
I download file into example.1.19.zr.1 and when I am in folder example.1.19.zr.1, I click button with this script
for %%* in (.) do set CurrDirName=%%~nx*
copy "\.......%folder%\%folder%.zr.%CurrDirName:~-1%\*.pdf" ".......\%folder%\%folder%.prod.%CurrDirName:~-1%"
ren ".......\%folder%\%folder%.prod.%CurrDirName:~-1%\*.pdf" "%folder%.prod.%CurrDirName:~-1%.pdf"
echo | set /p=%folder%|clip
Of course I can modify last line of this script to create correct path but I ask, is it possible to change directory from ......example.1.19\example.1.19.zr.1 to ......example.1.19\example.1.19.prod.1 using one click button and clipboard?
Basically your question is:
you are in TC ........ in folder "D:\rive\path\abcZR.1"
and want to switch to folder "D:\rive\path\abcPROD.1"
by use of a button click?
- take current folder name
- change in string ZR to PROD
- go one level up ..
- enter prod folder
I am in TC in "D:\rive\path\abcZR.1"
and I have button with command line: em_usercmd_prod_form_zr,cm_GoToParent
where em_usercmd_prod_form_zr is script
I need third command to go into "D:\rive\path\abcPROD.1"
I know that I click twice and go there and it's not perfect I though that is possible to use CD command with clipboard in some way, to connect third command with em_usercmd_prod_form_zr,cm_GoToParent, then it will work perfect
1. write a script to do the modification of the path string (example see below)
Save script in your TC-folder.
2. create a button to execute that script:
(%P causes the source path to be inserted into the command line, including a backslash (\) at the end.)
(press [Help] in button-dialog to read more)
3.) go into one of the folders with "ZR" in name,
click your new button,
current path is taken and provided as argument to the script ("%P") and is in script (%1) modified to PROD,
next nsps' command is used to tell TC to change the path in current panel
(see Help > Configuration and Switches > Command line parameters)
Code: Select all
@ECHO OFF REM MS-DOS Batch script for TotalCommander REM Found at: https://ghisler.ch/board/viewtopic.php?p=352442#p352442 REM From "D:\rive\path\abcZR.1" REM go to "D:\rive\path\abcPROD.1" ECHO %1 SET in=%~1 SET out=%in:ZR=PROD% ECHO %out% %COMMANDER_EXE% /O /S /L="%out%" PAUSE
Of course you can safely remove the ECHO and PAUSE commands.
I used this solution, its was easier to me, thanks
Stefan2, thank you too but i'm not programmer,