Platforms to show: All Mac Windows Linux Cross-Platform
/CURL/SFTP/CURLS sftp rename file
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/SFTP/CURLS sftp rename file
This example is the version from Wed, 3rd Jan 2023.
Project "CURLS sftp rename file.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
Run
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 EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
Control oldName Inherits TextField
ControlInstance oldName Inherits TextField
End Control
Control StaticText11 Inherits Label
ControlInstance StaticText11 Inherits Label
End Control
Control newName Inherits TextField
ControlInstance newName Inherits TextField
End Control
Control StaticText111 Inherits Label
ControlInstance StaticText111 Inherits Label
End Control
Control ResultText Inherits Label
ControlInstance ResultText Inherits Label
End Control
Private Sub Run()
dim s as string
dim e as integer
dim d as new CURLSMBS
dim command as string
command = "rename """+oldName.Text+""" """+newName.Text+""""
command = ConvertEncoding(command, encodings.ISOLatin1) // our server uses ISOLatin1...
d.SetOptionQuote array(Command)
d.CollectDebugMessages = true
d.CollectOutputData = true
d.OptionVerbose = true
d.OptionURL = ConvertEncoding(url.text, encodings.ISOLatin1) // our server uses ISOLatin1...
d.OptionUsername = "xxx" // change credentials
d.OptionPassword = "yyy"
e = d.Perform
select case e
case 0
// get output and show it. Maybe fix encoding
s = d.OutputData
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
s = ReplaceLineEndings(s, EndOfLine)
editfield1.text=s
else
// show debug messages
s = d.DebugMessages
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
s = ReplaceLineEndings(s, EndOfLine)
editfield1.text=s
end select
ResultText.text="Result: "+str(e)+" "+d.LasterrorMessage
End Sub
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:
The items on this page are in the following plugins: MBS CURL Plugin.