Way to append files efficiently using the DOS copy command

disk-operating-systemfile-transferfreedosms-dos

Using the DOS copy command syntax to concatenate files:

copy file1.txt+file2.txt all.txt

I know I can do this…

copy file1.txt+file2.txt file1.txt

Is this efficient? Is it doing what I'm expecting? It works, but I want to know is it actually appending to file1.txt or is it copying file1.txt (bad), concatenating file2 and then renaming to file1.txt (which is not efficient)?

Best Answer

copy is copying file1.txt and file2.txt into memory, concatenating them then writing out to file1.txt. It's not copying to a new file then renaming that file so really there's not much extra disk I/O.

You can also use type.

type file2.txt >> file1.txt

The >> operator appends text. But that will, of course, not work for binary files.

Related Question