copy with cr/lf



I'm using this script to copy a file all but the first line in the file. How
can I make sure each line that is copied to the newfile has a cr/lf at the
end of each record. I'm then using the newfile to Bulk Insert to a SQL table
and I think I'm adding records that I should'nt be because of the cr/lf

--Thanks--


' folder where the files resides

sSourceFolder = "C:\temp"



' folder where files are copied to

sTargetFolder = "C:\vsts"



dDate = Date

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set oFolder = oFSO.GetFolder(sSourceFolder)

For Each oFile In oFolder.Files

If DateDiff("d", oFile.DateCreated, dDate) = 0 Then

FileName= oFile.Name

If len(FileName)>3 then

If left(FileName,3)= "abs" and right (FileName,3)= "txt"
and instr(FileName, "_gli")>0 then

' read a line

Set objfileRead= oFSO.OpenTextFile(sSourceFolder &
"\" & FileName,1,false)

s= objfileRead.ReadLine()

s= objfileRead.Readall()

objfileRead.CLose()



Set objfileWrite= oFSO.OpenTextFile(sTargetFolder &
"\" & FileName,2,true)

objfileWrite.Write(s)

objfileWrite.CLose()

End if

End if

End if

Next


.



Relevant Pages


Loading