copy with cr/lf
- From: "Hoosbruin" <Hoosbruin@xxxxxxxxxxxx>
- Date: Mon, 16 May 2005 17:47:07 -0500
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
.
- Follow-Ups:
- Re: copy with cr/lf
- From: Fabrice Canel [MSFT]
- Re: copy with cr/lf
- Prev by Date: Re: Convert easy batch file to a vbscript?
- Next by Date: Re: Script Printer Driver Installation and Network Printer Connection
- Previous by thread: Convert easy batch file to a vbscript?
- Next by thread: Re: copy with cr/lf
- Index(es):
Relevant Pages
|
Loading