Re: Data in file sent through SFTP are being trunc - WeOnlyDo Discussion board

Re: Data in file sent through SFTP are being trunc (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Tomek, Monday, May 11, 2009, 15:32 (5676 days ago)

I couldn't edit so below is my post in more clear form.

Hi,


In version 3.3.0 when I send files using putfile at the begining of the file different number of rows(characters) are being removed/truncated.

I tested it creating file in csv format with numbers in the column and when I send that file one time first row was row #7 next time row number 20 ect. When I downgraded to 3.2.0 this problem disappeard. Please advice

[code]


Dim filesys, localsrcdir, fil, filecoll, v3, objFTP, key
Dim passphrase, keyfile, remotedir_name, remotedir


Set filesys = CreateObject( Scripting.FileSystemObject )
Set objFTP = WScript.CreateObject( WeOnlyDo.wodSFTPCom.1 , wod_ )
Set key = WScript.CreateObject( WeOnlyDo.Keys.1 )


Const AccessingRawFile = 7
Const authPubkey = 2
Const typeDirectory = 0
const ForAppending = 8
Const Connected = 3
Const Connecting = 1
Const Disconnected = 0
Const Executing = 6
Const LogonInProgress = 2
Const Receiving = 4
Const Sending = 5

localsrcdir= SOURCEDIR

objFTP.Hostname = HOSTNAME
objFTP.Login = myUID
passphrase = mypassphrase
keyfile = KEYFILEPATH
remotedir_name = REMOTEDESTDIR


remotedir = / & remotedir_name
key.Load keyfile, CStr(passphrase)
objFTP.PrivateKey = key.PrivateKey(0)
objFTP.Authentication = authPubkey

Set localsrcdirobj = filesys.GetFolder(localsrcdir)
Set filecoll = localsrcdirobj.Files

objFTP.Blocking = 1
objFTP.Resume = True
objFTP.Connect


For Each fil in filecoll

Dim fn

fn = fil.Name
objFTP.PutFile localsrcdir & & fn, CStr(remotedir)

Next


objFTP.Disconnect


Sub wod_Connected(ErrorCode, ErrorText)

WScript.Echo Now & Connected & ErrorText

End Sub


Sub wod_Disconnected()

wScript.Echo Now & Disconnected

End Sub


Sub wod_StateChange(OldState)

Dim v3
v3 = Len(fn)

If (OldState = 7 Or OldState = 4 Or OldState = 5 ) Then
If v3 > 3 Then
wScript.Echo Now & & objFTP.StateText(OldState)
If OldState = 5 then
wScript.Echo Now & Sending file to & remotedir & / & fn
ElseIf OldState = 4 Then
wScript.Echo Now & Receiving file from & remotedir & / & fn
End If
End If
Else
wScript.Echo Now & & objFTP.StateText(OldState)
End If

End Sub


Sub wod_Done(ErrorCode, ErrorText)

If ErrorCode = 0 Then

WScript.Echo Now & File & localsrcdir & & fn & uploaded successfully to & remotedir & / & fn


Else

WScript.Echo Now & ERROR uploading file: & ErrorCode & & ErrorText

End if

End Sub

Set sysfile = Nothing
Set objFTP = Nothing
Set key = Nothing

[/code]

Re: Data in file sent through SFTP are being trunc

by wodDamir, Monday, May 11, 2009, 15:50 (5676 days ago) @ Tomek

Tomek,

I just tried this:

[code]sftp1.HostName = your_host
sftp1.Login = your_login
sftp1.Password = your_password
sftp1.Blocking = True
sftp1.Resume = True
sftp1.Connect

sftp1.PutFile C:Book1.csv , /home/weonlydo/

sftp1.GetFile C:Book.csv , /home/weonlydo/Book1.csv [/code]

And it worked like a charm. Can you please try that code?

Regards,
Damba

Re: Data in file sent through SFTP are being trunc

by Tomek, Monday, May 11, 2009, 16:14 (5676 days ago) @ wodDamir

Hi Damba,

Just tried this:
[code]

Set sftp1 = WScript.CreateObject( WeOnlyDo.wodSFTPCom.1 , wod_ )

sftp1.HostName = hostname
sftp1.Login = UName
sftp1.Password = pass
sftp1.Blocking = True
sftp1.Resume = True
sftp1.Connect

sftp1.PutFile Book1.csv , /u/

sftp1.GetFile e:Book.csv , /u/Book1.csv

sftp1.Disconnect

[/code]

and still not working. This is my Book1.csv

Before:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

After:
<- first one is blank and in second row number 7 is the first one
7
8
9
10
11
12
13
14
15
16
17

Tomek,

I just tried this:

[code]sftp1.HostName = your_host
sftp1.Login = your_login
sftp1.Password = your_password
sftp1.Blocking = True
sftp1.Resume = True
sftp1.Connect

sftp1.PutFile C:Book1.csv , /home/weonlydo/

sftp1.GetFile C:Book.csv , /home/weonlydo/Book1.csv [/code]

And it worked like a charm. Can you please try that code?

Regards,
Damba

Re: Data in file sent through SFTP are being trunc

by woddrazen, Monday, May 11, 2009, 16:50 (5676 days ago) @ Tomek

Tomek,


Can you maybe send us your csv to:

techsupport@weonlydo.com

so we can test using same file and hopefully duplicate your problem.


Drazen