Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Filename to the end of a text string

Status
Not open for further replies.

NickC111

Technical User
Sep 23, 2010
44
GB
I have a basic script that compares two text files and writes a new file with the difference on a new line.

I want to be able to add the filename to the end of each line but I need some help

Code[Set fso=CreateObject("Scripting.FileSystemObject")

Set txtfile=fso_OpenTextFile("c:\thursday.txt")

data=txtfile.readAll

txtfile.close

txtArray=split(data,vbCRLF)

Set txtfile=fso_OpenTextFile("c:\friday.txt")

data=txtfile.readAll

txtfile.close

dim list

for n=0 to ubound(txtArray)

if instr(data,txtArray(n))=0 then list=list & txtArray(n) & vbCRLF

next

Set txtfile=fso.CreateTextFile("fridayMissing.txt")

txtfile.write list

txtfile.close

]

Hope you can help -
 
I don't follow. You mean like [tt]list = list & txtArray(n) & "fridayMissing.txt"[/tt]

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Sorry if I didn't explain myself but what you said worked perfectly.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top