I am working on a project that required data to be pulled from a hp-unix box and populate a excel worksheet. One option they are wanting to include in this app is to let a user select the unix directory to look at files. Do far my solution is to use the inet control to get the list of files/directories and put into a text file then display on screen by reading text files. My issue is when I do a DIR I get funky character/letter at the front and end of the output. I can not just change the vbLF with vbCrLf. This is not the solution.
Does know how to get just the info without the unix crap?
Thanks in advance.
Here is my code to pull the list:
Public Sub sbGetDirList()
'=========================================================
'=========================================================
Dim sPathFile As String
Inet1.URL = "ftp://IP_OF_UNIX_BOX"
Inet1.UserName = username
Inet1.Password = password
Inet1.Protocol = icFTP
Inet1.Execute Inet1.URL, "cd /log/dir/
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute Inet1.URL, "DIR *.txt "
Do While Inet1.StillExecuting
DoEvents
Loop
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
'=========================================================
'=========================================================
Dim vtData As Variant ' Data variable.
Dim sPath As String
Select Case State
' ... Other cases not shown.
Case icResponseCompleted ' 12
' Open a file to write to.
sPath = gsDir & "alltxtfiles.txt"
Open sPath For Binary Access Write As #1
' Get the first chunk. NOTE: specify a Byte
' array (icByteArray) to retrieve a binary file.
vtData = Inet1.GetChunk(1024, icString)
Do While LenB(vtData) > 0
Put #1, , vtData
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
Loop
Put #1, , vtData
Close #1
End Select
End Sub
Does know how to get just the info without the unix crap?
Thanks in advance.
Here is my code to pull the list:
Public Sub sbGetDirList()
'=========================================================
'=========================================================
Dim sPathFile As String
Inet1.URL = "ftp://IP_OF_UNIX_BOX"
Inet1.UserName = username
Inet1.Password = password
Inet1.Protocol = icFTP
Inet1.Execute Inet1.URL, "cd /log/dir/
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute Inet1.URL, "DIR *.txt "
Do While Inet1.StillExecuting
DoEvents
Loop
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
'=========================================================
'=========================================================
Dim vtData As Variant ' Data variable.
Dim sPath As String
Select Case State
' ... Other cases not shown.
Case icResponseCompleted ' 12
' Open a file to write to.
sPath = gsDir & "alltxtfiles.txt"
Open sPath For Binary Access Write As #1
' Get the first chunk. NOTE: specify a Byte
' array (icByteArray) to retrieve a binary file.
vtData = Inet1.GetChunk(1024, icString)
Do While LenB(vtData) > 0
Put #1, , vtData
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
Loop
Put #1, , vtData
Close #1
End Select
End Sub