Hi, I'm trying to write a batch file that will copy all text files from a directory and append them to a .txt file. So far I have: type *.txt >>C:\directory\all.txt
This works but it doesn't return in the new text file after appending each text file.
e.g. new file reads:
textfile1contenttextfile2contenttextfile3contentI would like the new file to read:
textfile1content
textfile2content
textfile3contentAny help is appreciated
copy /B *.txt c:\directory\all.txt
Thanks for the response but it is still outputting: textfile1contenttextfile2contenttextfile3content
@echo Off
@For %%a in ("*.txt") do echo >> %%a
type *.txt >> all.txt
Hope this helps. I tried it with the example you gave. This does alter the file! If that is not allowed, then we can modify it to create a copy of the files and alter those files and then delete them.
@echo Off
@For %%a in ("*.txt") do copy %%a %%a_COPY.txt
@For %%a in ("*.txt_COPY.txt") do echo >> %%a_COPY.txt
type *.txt_COPY.txt >> all.txt
@for %%a in ("*.txt_COPY.txt") do del %%ahere is the modified version just in case! This works, but may not be the cleanest code.
for %%a in (*.txt) do @(type %%a &echo.) >> out ren out out.txt
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |