jasont09
asked on
Merge Text Files At Exact Point
Hi
I am trying to merge to text files in a folder. At the moment the newest file (1) in the folder gets appended to the end of the oldest file (2). (there are only to files in this folder)
The text files are templates and within the oldest file (2) I have 7 breakpoints highlighted by @*#*@
My Aim is to insert file (1) before the 5th occurence of @*#*@
The current code I was using is fairly old and is in asp vbscript,
So rather than appending the 2nd file at the end of the 1st file, it will merge it and keep the end of the 1st file in tact.
Help much appreciated
I am trying to merge to text files in a folder. At the moment the newest file (1) in the folder gets appended to the end of the oldest file (2). (there are only to files in this folder)
The text files are templates and within the oldest file (2) I have 7 breakpoints highlighted by @*#*@
My Aim is to insert file (1) before the 5th occurence of @*#*@
The current code I was using is fairly old and is in asp vbscript,
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("D:\sites\")
set combinedFile=fs.CreateTextFile("D:\sites\export.txt",true)
for each x in fo.files
set fil = fs.getFile("D:\sites\" & x.Name)
if fil.size > 0 then
Set f=fs.OpenTextFile("D:\sites\" & x.Name)
combinedFile.WriteLine(f.ReadAll)
end if
set f = nothing
set fil = nothing
next
set fo=nothing
set fs=nothing
So rather than appending the 2nd file at the end of the 1st file, it will merge it and keep the end of the 1st file in tact.
Help much appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No problem. Thanks for the grade.
Regards,
Rob.
Regards,
Rob.
ASKER
Thanks again