Question

I want to merge content of all .txt files in my directory (containing subdirectories) to one txt file. I need to do this:

xcopy text1.txt + text2.txt text3.txt

but in a for loop which takes all text files in current directory. i assume something like this:

for \r ___ in ___ do copy list.txt

Thanks in advance.

Était-ce utile?

La solution

Use one % instead of two %% to run it from the command line.

for /r "c:\folder" %%a in (*.txt) do type "%%a" >>"bigfile.txt"

Autres conseils

Try:

@echo off
set "folder=folder"
for /F %%a in ('dir /b /s %folder%') do (
 if "%%~xa" == ".txt" (
  (echo/------------------------------
  type %%~a
  echo/)>>"%~dp0list.txt"
)
)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top