can't create a collection of names - Classic ASP - WeOnlyDo Discussion board

can't create a collection of names - Classic ASP (General questions)

by havey, Friday, October 13, 2006, 04:26 (6616 days ago)

Can someone please let me know why i'm having an issue creating an array

This is what i have:

set Sftp = Server.CreateObject( WeOnlyDo.wodSFTPCom.1 )
Sftp.LicenseKey = xxxxxx
Sftp.Timeout = 60
Sftp.Login = xxx
Sftp.Password = xxxxxxxxx
Sftp.HostName = xxxxxxxxx.com
Sftp.Blocking = 1
Sftp.Connect

Sftp.ListNames /ftp/ftpdelivery/dbqa/rk/ON/

x = Trim(Sftp.ListItem)


response.write x = & x 'results in: x = ./ ../ .bash_history 100015_200610111421_4001721_S.XML 100015_200610111442_4001721_M.XML 100015_200610111442_4001721_C.XML

' so i get a value for x that is trimmed

so now i'm going to split the file name at the spaces and create and array of the file names:

myArray = Split(x, )

response.write x: & Ubound(myArray) ' results in x:0 NO array created?

for i = 4 to Ubound(myArray) ' no array so this for loop doesn't function
Response.write myArray(i) & <br>
next

Sftp.Disconnect
Response.Flush
set Sftp = Nothing


* Now if I hard code the string that x is equal to and remove the Sftp stuff, so all i have is plain old fashiioned asp, the array works.

So why won't the array work in the above situation with the Sftp code incorporated?

Thanks[:doh:]

Re: can't create a collection of names - Classi

by wodDamir, Friday, October 13, 2006, 08:16 (6616 days ago) @ havey

Hi Havey,

I believe that if you do split expression using vbcrlf as a delimiter it should work perfectly.

Please try something like this:
------------------------------------------
sftp.ListNames ( Path_to_your_remote_dir )
x = sftp.ListItem
mayrray = Split(x, vbCrLf)
For i = 0 To UBound(myarray)
Debug.Print myarray(i)
Next
------------------------------------------

Hope I helped.

Regards,
Damba

Re: can't create a collection of names - Cl

by havey, Friday, October 13, 2006, 17:26 (6616 days ago) @ wodDamir

Thanks for the suggestion,
turns out that when i urlEncoded the string the spaces where actually: D A

so i splited on that, for the array.

[:doh:]