I'm kind of new to this, so please bear with me. I have been trying to make a shell script that can do the following:
convert a FoxBase v3.0 .DAT file into a comma delimited .csv file.
I decided to go with a VBScript and this the code that I have so far. So far what I've come up with is a corrupt .csv file. When I add it to Splunk! it reads as corrupted and not a (comma delimited) csv file. I was hoping to get some pointers.
I was able to figure out my mistake I'll post the correct code below.
Const ForReading = 1, ForWriting = 2, ForAppending = 3
dim fso, strDirectory, strOutPut, fLocation, fNewName, objWorkbook, local
local = true
Set objExcel = CreateObject("Excel.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
objExcel.Application.DisplayAlerts = False
objExcel.Application.Visible = False
'Open Text Files for use
Set strDirectory = fso.OpenTextFile("D:\_Work\_Splunk\_TestBed\DATFileLocations.txt", ForReading, TristateFalse)
Set strFileName = fso.OpenTextFile("D:\_Work\_Splunk\_TestBed\csvFileNames.txt", ForReading, TristateFalse)
Do Until strDirectory.AtEndOfStream
fLocation = strDirectory.ReadLine 'Get the location of the DAT file
fNewName = strFileName.ReadLine 'Get the name of the target csv file
Set objWorkbook = objExcel.Workbooks.Open(fLocation) 'Open the DAT file
objExcel.ActiveWorkbook.SaveAs fNewName, 6 'Save the DAT file as a csv
'Close the text files'
'Set strDirectory = Nothing
'Set strFileName = Nothing