Platforms to show: All Mac Windows Linux Cross-Platform
/CURL/FTP/CURLS ftp directory browsing
Required plugins for this example: MBS CURL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/FTP/CURLS ftp directory browsing
This example is the version from Wed, 3rd Jan 2023.
Project "CURLS ftp directory browsing.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
ListFiles ""
End EventHandler
End Control
Control URL Inherits TextField
ControlInstance URL Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub DoubleClick()
Listfiles me.Cell(me.ListIndex,0)
End EventHandler
End Control
Private Sub ListFiles(NewPathComponent as string)
dim s as string
dim e as integer
dim d as new CURLSMBS
dim NewPath() as string
dim u as integer = UBound(path)
if NewPathComponent = ".." then
u = u -1
end if
for i as integer = 0 to u
NewPath.Append path(i)
next
if NewPathComponent <> ".." then
NewPath.Append NewPathComponent
end if
dim NewPaths as string = Join(NewPath, "/")
if NewPaths <> "" then
NewPaths = NewPaths + "/"
end if
d.CollectDebugMessages = true
d.CollectOutputData = true
d.OptionVerbose = true
d.OptionURL = url.text + NewPaths
d.OptionUsername = "xxx"
d.OptionPassword = "xxx"
d.OptionDirListOnly = true
e = d.Perform
select case e
case 0
s = d.OutputData
// fix encoding?
if s.Encoding = nil then
if encodings.UTF8.IsValidData(s) then
s = DefineEncoding(s, encodings.UTF8)
else
s = DefineEncoding(s, encodings.ISOLatin1)
end if
end if
// replace line endings
s = ReplaceLineEndings(s, EndOfLine)
dim items() as string = split(s, EndOfLine)
List.DeleteAllRows
for each it as string in items
if it = ".." and NewPaths = "" then Continue // not in root
if it = "" then Continue
if it = "." then Continue
List.AddRow it
next
Path = NewPath
case 9
MsgBox "Access denied" // maybe a file, not a folder?
case 67
MsgBox "Login denied"
else
dim de as string = d.DebugMessages
Break
end select
End Sub
Property Private Path() As String
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
- /CURL/FTP/CURLS ftp create or folder delete
- /CURL/FTP/CURLS ftp directory listing
- /CURL/FTP/CURLS ftp directory listing with Web Edition
- /CURL/FTP/CURLS ftp directory listing with wildcard
- /CURL/FTP/CURLS ftp download to desktop with thread
- /CURL/FTP/CURLS ftp file delete
- /CURL/FTP/CURLS ftp file upload resume
- /CURL/FTP/CURLS ftp file upload with thread
- /CURL/FTP/CURLS ftp file uploads
- /CURL/FTP/CURLS ftp secure upload
The items on this page are in the following plugins: MBS CURL Plugin.