Combine all text file in directory into one file.
"Rich" wrote...
....
I need to do the following. I need to combine all the text files
in directory "C:\ECPJM" into one text file called "Combined.txt". Any
help would be greatly appreciated.
While this may offend the VBA purists, I'd recommend searching for the
ShellAndWait function in the Google Groups archive for this newsgroup, and
using it to run
Call ShellAndWait(Environ("ComSpec") & " /c copy " & _
DirectoryPath & "\*.txt " & DirectoryPath & "\x.x")
Name DirectoryPath & "\x.x" As DirectoryPath & "\Combined.txt"
In general, Windows's command interpreter's COPY command is the best tool
available for combining text files. Using anything else is pointless wheel
reinvention.
|