for %%FIC in "*.txt" do ( echo %%FIC ; echo %%FIC%% ) > fichier.txt
jeannets
Contributor
Hello,
copy *.txt > récup.txt
you could also do copy fich1 + Fich2 + Fich3 > Recup.txt
this way, all the end-of-file marks (Ctrl+Z) are copied at the same time
and you could use this end-of-file mark. The /a switch allows that.
Otherwise, you need to create a BAT or cmd file that contains your copy command and also the integration of the separator you have chosen.
Xcopy does not allow this.
I hope this helps you.
lock
Author
Thank you for your answers but..
@jeannets --> I have more than 200 fics to merge That's why I'm adding *.txt It seems to be working but I don't see a separator..
@alhuno --> How to use the command?
alhuno1
Contributor
%%fic is the file number in the FOR loop. %fic is the name of the file, we want to add it as a separator, hence the echo %Fic %fic% is the content of the files. Basically, it's a for loop that applies the operation to all the files. Programming concept. Too bad it's DOS, in Linux it can be done just like that.
alhuno1
Contributor
You write it exactly as is in the command line.
lock
Author
Hello if I run it as is, I get: %%FIC was unexpected. What should I replace %%FIC and %FIC with? My case is the following: directory c:\toto that contains 200 txt files, I want to compile them into one single txt file with a carriage return or a line that separates each file.. THANK YOU
jeannets
Contributor
The separator is not visible with Notepad; it needs to be viewed with a hexadecimal editor... it's 03 for ETX or 04 for EOF (end of File)
There is also 0A0D which are LF and CR (line Feed and Carriage Return) but it can also exist at every line break in the text.
These characters may very well not exist depending on the source of the files..
With the pure DOS editor "Edlin", this character is created by pressing Ctrl+z