This is a very cumbersome step with some disadvantages. I can't select files from the two panels to merge them, nor can I use cm_DirBranch to expand multiple directories and then select files to merge them.
Improvement suggestions:
Select multiple text files directly in the panel list, and then run cm_Combine to merge them directly
Below, I used bat to replicate the cm_Combine command.
For example:
Code: Select all
[em_MergeFiles]
cmd=MergeFiles.bat
param="%T" %P%S
Code: Select all
@echo off
shift
set "path=%~0"
if exist "%path%" (
pushd "%path%" >nul 2>&1
if errorlevel 1 (echo Path is not a directory: %path% & pause>nul & exit)
popd >nul
) else (echo Path does not exist: %path% & pause>nul & exit)
set "F=.txt .reg .bat .ini"
set "E=%~x1"
if "%E%" equ "" (set "E=.txt")
for %%i in (%F%) do (
if "%E%" equ "%%i" (set "a=1" & break)
)
if "%a%" neq "1" (set "E=.txt")
set "T=%path%new_%TIME:~3,2%%E%"
:loop
shift
if "%~0" equ "" (exit)
if "%~x0" equ "" (goto loop)
for %%i in (%F%) do (
if "%~x0" equ "%%i" (type "%~0" >> "%T%" & break)
)
goto loop
Suggestions:
- Remove the prerequisite that the files must be in ascending order, so that I can select files from both panels to merge them, or use the cm_DirBranch command to expand multiple directories and then select files to merge them.
- Add some parameters:
- /T: output path after merging files.
- /E: output extension.
- /F: filter, some file extensions are selected by mistake, automatically ignored.
- /G: Quiet mode, start merging files immediately.
- In MergeFiles.bat above, I have implemented these parameters.
Merge files. Is there any other more efficient script method now?