Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

newm2156

Posts

36

Joined

Sat Sep 23, 2006 1:11 am

Exclude sub directoeries in multipleFileUpload

by newm2156 » Sat Jun 01, 2013 5:48 am

I am using latest version ftppro and want to exclude sub directories when doing beginmulitplefileupload method. transfer works perfect but includes all tjhe subs which i do not want to do. Thoughts?
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Exclude sub directoeries in multipleFileUpload

by support2 » Sat Jun 01, 2013 11:02 pm

There's a few multiple upload methods - which one are you using? For example this method:

public virtual IAsyncResult BeginUploadMultiple(string localDirectory, string remoteDirectory,
string wildcard, bool includeSubDirs, AsyncCallback callback, object state)

has a boolean to specifically say if subdirs should be included.
no avatar
User

newm2156

Posts

36

Joined

Sat Sep 23, 2006 1:11 am

yepper

by newm2156 » Mon Jun 03, 2013 9:24 pm

geez, how did i miss that. thanks...
no avatar
User

newm2156

Posts

36

Joined

Sat Sep 23, 2006 1:11 am

still doesn't work...

by newm2156 » Tue Jun 04, 2013 4:54 am

i added the boolean as FALSE and still transfers the subfolders. I must bemissing something....here is my code, which works except for transferring the subfolders:

Dim filterString As String = "*.*"

If (Not ftpConnection Is Nothing) Then
ftpConnection = Nothing
ftpConnection = New SecureFTPConnection
Else
ftpConnection = New SecureFTPConnection
End If

Try

arcfinalLocation = arcFileLocation

ftpConnection.************ = ************
ftpConnection.********* = *********

ftpConnection.Protocol = FileTransferProtocol.FTPSExplicit
ftpConnection.ServerValidation = SecureFTPServerValidationType.None
ftpConnection.ConcurrentTransferSettings.Enabled = True
ftpConnection.ConcurrentTransferSettings.MaxConnections = 5

ftpConnection.ServerAddress = serverAddress
ftpConnection.ServerPort = serverPort
ftpConnection.UserName = userName
ftpConnection.Password = password

CallClient("Queuing connection to " & serverAddress)

ftpConnection.BeginConnect(New AsyncCallback(AddressOf OnConnect), ftpConnection)
ftpConnection.UploadDirectory(localfolder, remotefolder)
ftpConnection.BeginUploadMultiple(localfolder, remotefolder, filterString, False, New AsyncCallback(AddressOf OnUpload), ftpConnection)
ftpConnection.BeginClose(New AsyncCallback(AddressOf OnClose), ftpConnection)

signaller.WaitOne()

Catch exFtp As FTPException
CallClient("FTP Error:" & exFtp.ToString)
Catch ex As Exception
CallClient("non FTP Error:" & ex.ToString)

Finally
If (Not ftpConnection Is Nothing) Then ftpConnection = Nothing
End Try



My onUopload function is:


Private Sub OnUpload(ByVal ar As IAsyncResult)
Dim c As SecureFTPConnection = CType(ar.AsyncState, SecureFTPConnection)
c.EndUploadMultiple(ar)
CallClient("Upload completed: ")
End Sub
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: still doesn't work...

by support2 » Tue Jun 04, 2013 6:41 am

You need true to transfer subfolders.
no avatar
User

newm2156

Posts

36

Joined

Sat Sep 23, 2006 1:11 am

set to false is correct

by newm2156 » Wed Jun 05, 2013 12:06 am

thats the issue. I set it to False to not transfer subfolders, but subfolders still are being transferred.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: set to false is correct

by support2 » Wed Jun 05, 2013 4:36 pm

What about

ftpConnection.UploadDirectory(localfolder, remotefolder)

that's going to upload the entire directory recursively.
no avatar
User

newm2156

Posts

36

Joined

Sat Sep 23, 2006 1:11 am

any good examples

by newm2156 » Thu Jun 06, 2013 10:40 pm

This ftpConnection.UploadDirectory(localfolder, remotefolder) works just finer, but i do not want to transfer any sub directories, just the top level files

I have this structure:
Level 1
file#1
file#2
--level 2 folder 1
--level 2 folder 2
I want to transfer only file 1 and 2 and nothinelse.

I an trying to use ftpConnection.BeginUploadMultiple(localfolder & "\", remotefolder, "*.*", False, New AsyncCallback(AddressOf OnUpload), ftpConnection)

and that does not transfer any files at all.

I cannot find any good examples of an async file uplaod ... any ideas or example code.
no avatar
User

newm2156

Posts

36

Joined

Sat Sep 23, 2006 1:11 am

got it to work

by newm2156 » Fri Jun 07, 2013 1:12 am

fin ally it works : ftpConnection.BeginUploadMultiple(localfolder & "\", remotefolder, "*.*", False, New AsyncCallback(AddressOf OnUpload), ftpConnection)



i just unistalled and reinstalled latest version (as admin) in win 7 and it worked out of the box. sub folders are not beiong transferred now.

thanks for your help.....

Who is online

Users browsing this forum: No registered users and 31 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron