[MBS CURL] Upload All Files From a Folder to FTP

Hey guys,

I’m working with the MonkeyBread CURL Plugin and I’m trying to upload all files from a folder to a FTP, so far I’ve been able to send one files, is there a way to read the folder and upload all of it’s content to the FTP?

Here is the code I’ve been using so far:

 dim f as FolderItem
  dim e as integer
  dim d as UploadCURL
  dim b as BinaryStream
  dim FileName As String
  
  f=GetOpenFolderItem("all")
  if f=nil then Return
  
  b = BinaryStream.Open(f)
  
  FileName = f.Name
  
  d=new UploadCURL
  d.stream=b
  d.OptionURL=URLUpload.text+FileName
  d.OptionUpload=true
  d.OptionInFileSize=b.Length
  
  ProgressWindow.file.text=f.DisplayName
  ProgressWindow.show
  e=d.Perform
  
  ProgressWindow.close
  
  LBXUpload.addrow "Result: "+str(e)

There is no command to upload them all.
You have to make a loop and run an upload per file.
you can of course run them in parallel.

@Christian Schmitz How would you suggest doing that?

I have thought of putting them in different threads, but some servers might baulk at having 50 FTP transfers running at once. I could manage this to a user set limit, but is there a better and recommended method for multi-file transfer?

[quote=241306:@Christian Schmitz]There is no command to upload them all.
You have to make a loop and run an upload per file.
you can of course run them in parallel.[/quote]

Hey Christian, thank you very much, I just found that out… but now I have the same question as David, how do you suggest doing that?

we do have CurlSMultiMBS class for efficient parallel transfers.

And I would only run a few, maybe 3 parallel.