DataFlex
DataFlex
chmod (Setting File Permissions)
See more FTP Examples
This example assumes your FTP server supports the "chmod" command, which typically means it must be a server running on a Linux or Unix system. The SendCommand method may be called to send arbitrary commands to the FTP server. This example sends a "chmod" command to set the file permissions.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoFtp
String sResp
String sTemp1
Boolean bTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatFtp2)) To hoFtp
If (Not(IsComObjectCreated(hoFtp))) Begin
Send CreateComObject of hoFtp
End
Set ComHostname Of hoFtp To "ftp.cknotes.com"
Set ComUsername Of hoFtp To "myLogin"
Set ComPassword Of hoFtp To "myPassword"
// Connect and login to the FTP server.
Get ComConnect Of hoFtp To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
Procedure_Return
End
// Send a chmod command to the FTP server to set
// the permissions of a file to 0644:
Get ComSendCommand Of hoFtp "chmod 0644 hamlet.xml" To sResp
Get ComLastMethodSuccess Of hoFtp To bTemp1
If (bTemp1 <> True) Begin
// Failed.
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
End
Else Begin
// You should write code to examine the response to
// the SendCommand. As an example, the FTP server
// used for testing responds with this for success:
// 200 Permissions changed on hamlet.xml
Showln sResp
End
Get ComDisconnect Of hoFtp To iSuccess
End_Procedure