What I need to do is (and I have some idea, just can’t get this solidified):
- Read all files in a directory (for loop)
- In loop, I need to copy the current file in the loop’s contents into a new file (x.txt into x2.txt) in the same directory. This can be done with a type >> command.
I’m more confused about the looping part of it. How do I do that?
Edit:
This is my current script:
FOR %%i IN (*)
Do type %%i >> %%i2
This will copy each
.txtfile to a backup file with extension.txt2:Note that in a batch file you need to double the
%:It’s not clear from your question if you want all found files dumped into the same resulting text file or if you want one-to-one copies of each.
If you just want one results file, you could also use a variant of the copy command, i.e.: