I have a directory with some text files I like to merge
that can be done by copy c:\myfolder\*.txt destfile.txt
But what I need to do is to have the files in a specific order (ie only a few of them is important)
So what I want to do is having a file fileorder.txt (not in the same folder)
that contains the files that should be first in that order
so the cmd file shoud read the fileorder.txt
and merge all the files that are in there into destfile.txt
then all the other files that are not in fileorder.txt should be appended after
those files.
How can i do that?
ProgrammingScripting Languages
Last Comment
pucko73
8/22/2022 - Mon
Qlemo
@echo offcd /d C:\Targetfoldercopy nul DestFile.txt >nulfor /F "tokens=*" %%F in (c:\FileOrder.txt) do copy DestFile.txt+"C:\MyFolder\%%~F" >nulfor /F "tokens=*" %%F in ('dir C:\MyFolder\*.txt /b ^| findstr /V /G:C:\FileOrder.txt') do ^copy DestFile.txt+"%%~F" >nul
Open in new window