dear folks,

How do I such thing using FSO? Let me know your comments and thoughts.
Best wishes,

Re: Copying two file into another one by \

\
Thu Jan 26 12:43:13 CST 2006

> How do I such thing using FSO? Let me know your comments and thoughts.
> Best wishes,

Need some clarification. Do you want to merge two files into a single new file,
or add two files to an existing third file?
--
Crash



Re: Copying two file into another one by Enric

Enric
Thu Jan 26 12:58:02 CST 2006

hi colleague,
right. I was talking about to copy the contents of file1.txt and file2.txt
into file3.txt
thanks in advance,

""Crash" Dummy" wrote:

> > How do I such thing using FSO? Let me know your comments and thoughts.
> > Best wishes,
>
> Need some clarification. Do you want to merge two files into a single new file,
> or add two files to an existing third file?
> --
> Crash
>
>
>

Re: Copying two file into another one by \

\
Thu Jan 26 13:23:35 CST 2006

> hi colleague,
> right. I was talking about to copy the contents of file1.txt and file2.txt
> into file3.txt
> thanks in advance,

That's pretty straightforward:

Set fso=CreateObject("Scripting.FileSystemObject")

Set inFile=fso.OpenTextFile("file1.txt")
data1=inFile.readAll
inFile.close

Set inFile=fso.OpenTextFile("file2.txt")
data2=inFile.readAll
inFile.close

Set outFile=fso.CreateTextFile("file3.txt")
outFile.write data1 & data2
outFile.close
--
Crash





Re: Copying two file into another one by Enric

Enric
Fri Jan 27 02:35:02 CST 2006

it was very kind of you. very useful

""Crash" Dummy" wrote:

> > hi colleague,
> > right. I was talking about to copy the contents of file1.txt and file2.txt
> > into file3.txt
> > thanks in advance,
>
> That's pretty straightforward:
>
> Set fso=CreateObject("Scripting.FileSystemObject")
>
> Set inFile=fso.OpenTextFile("file1.txt")
> data1=inFile.readAll
> inFile.close
>
> Set inFile=fso.OpenTextFile("file2.txt")
> data2=inFile.readAll
> inFile.close
>
> Set outFile=fso.CreateTextFile("file3.txt")
> outFile.write data1 & data2
> outFile.close
> --
> Crash
>
>
>
>
>

Re: Copying two file into another one by Evertjan

Evertjan
Fri Jan 27 03:24:34 CST 2006

"Crash" Dummy wrote on 26 jan 2006 in
microsoft.public.scripting.vbscript:

>> hi colleague,
>> right. I was talking about to copy the contents of file1.txt and
>> file2.txt into file3.txt
>> thanks in advance,
>
> That's pretty straightforward:
>
> Set fso=CreateObject("Scripting.FileSystemObject")
>
> Set inFile=fso.OpenTextFile("file1.txt")
> data1=inFile.readAll
> inFile.close
>
> Set inFile=fso.OpenTextFile("file2.txt")
> data2=inFile.readAll
> inFile.close
>
> Set outFile=fso.CreateTextFile("file3.txt")
> outFile.write data1 & data2
> outFile.close

Or [not the OQ, I know] append file2 to file1:

Set inFile=fso.OpenTextFile(myPathAndFile2)
ForAppending = 8
Set appFile = fso.OpenTextFile(myPathAndFile1,ForAppending)
appFile.write inFile.readAll
appFile.close
inFile.close

Not tested !!!!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Copying two file into another one by mr_unreliable

mr_unreliable
Fri Jan 27 12:07:54 CST 2006

not fso, but simple and effective:

oShell.Run "%comspec% /c copy file1.txt+file2.txt bigfile.txt

old batch guy, jw