There is probably no other way to do this, but is there a way to append the contents of one text file into another text file, while clearing the first after the move?
The only way I know is to just use a reader and writer, which seems inefficient for large files…
Thanks!
No, I don’t think there’s anything which does this.
If the two files use the same encoding and you don’t need to verify that they’re valid, you can treat them as binary files, e.g.
Note that if
file1.txtcontains a byte order mark, you should skip past this first to avoid having it in the middle offile2.txt.If you’re not using .NET 4 you can write your own equivalent of
Stream.CopyTo… even with an extension method to make the hand-over seamless: