Concatenate text files from subfolders

Just a small batch snippet to concatenate text files located in subfolders into one text file. I needed this to collect all single output data files from some measurements.

for /F "delims=" %%f in (
  ' Dir /B /S /O /A-D *.cnt ^|find /v /i "output.txt" '
) do (
echo "%%f" >> output.txt
type "%%f" >> output.txt
)

This will search subdirectories for files with .cnt extension and echo their name and type their content into output.txt.

Vorheriger Beitrag Nächster Beitrag