Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in .NET FTP by (1.4k points)
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?

8 Answers

0 votes
by (161k points)
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.
0 votes
by (1.4k points)
geez, how did i miss that. thanks...
0 votes
by (1.4k points)
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.LicenseOwner = LicenseOwner
ftpConnection.LicenseKey = LicenseKey

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
0 votes
by (161k points)
You need true to transfer subfolders.
0 votes
by (1.4k points)
thats the issue. I set it to False to not transfer subfolders, but subfolders still are being transferred.
0 votes
by (161k points)
What about

ftpConnection.UploadDirectory(localfolder, remotefolder)

that's going to upload the entire directory recursively.
0 votes
by (1.4k points)
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.
0 votes
by (1.4k points)
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.....

Categories

...