Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

CURL.SetOptionQuote

Sets the list of FTP or SFTP commands to pass to the server prior to your FTP request.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 2.5 Yes Yes Yes Yes Yes
MBS( "CURL.SetOptionQuote"; curl; Value )   More

Parameters

Parameter Description Example value
curl The CURL session handle. $curl
Value The ftp commands. "mkdir testfolder"

Result

Returns "OK" on success.

Description

Sets the list of FTP or SFTP commands to pass to the server prior to your FTP request.
This will be done before any other commands are issued (even before the CWD command for FTP). Disable this operation again by passing no value to this function. When speaking to a FTP (or SFTP) server, prefix the command with an asterisk (*) to make libcurl continue even if the command fails as by default libcurl will stop at first failure.

The set of valid FTP commands depends on the server (see RFC 959 for a list of mandatory commands).

The valid SFTP commands are: chgrp, chmod, chown, ln, mkdir, pwd, rename, rm, rmdir, symlink.

This option takes a list of items. So this function takes a variable number of arguments. If you call function with 2 parameters, you set an empty list. If you call it with 5 parameters, you set a list with 3 values.

See also CURL.SetOptionPreQuote and CURL.SetOptionPostQuote.

Here is list of raw FTP commands:
http://en.wikipedia.org/wiki/List_of_FTP_commands

File names may be passed with quotes to include spaces in file names.

See also QUOTE option in CURL manual.

Examples

Delete file only:

MBS( "CURL.SetOptionQuote"; $curl; "DELE test.txt" )

Delete folder:

MBS( "CURL.SetOptionQuote"; $curl; "RMD testfolder" )

Create folder with FTP:

MBS( "CURL.SetOptionQuote"; $curl; "MKD testfolder" )

Rename file using two FTP commands:

MBS( "CURL.SetOptionQuote" ; $curl ; "RNFR foo.txt"; "RNTO bar.txt" )

Set file permissions:

MBS( "CURL.SetOptionQuote" ; $curl ; "SITE CHMOD 777 testfile")

Call with three parameters:

MBS( "CURL.SetOptionQuote"; handle; $value1; $value2; $value3 )

List all files:

MBS( "CURL.SetOptionQuote" ; $curl ; "NLST -all" )

Connect to FTP server and delete a file:

Set Variable [$curl; Value:MBS("CURL.New")]
#this is URL to ftp server
Set Variable [$r; Value:MBS("CURL.SetOptionURL"; $curl; "ftp://www.monkeybreadsoftware.de/")]
# set user name
Set Variable [$r; Value:MBS("CURL.SetOptionUsername"; $curl; "xxx")]
# set password
Set Variable [$r; Value:MBS("CURL.SetOptionPassword"; $curl; "xxx")]
# set delete command of file "test.jpg" in folder "images"
Set Variable [$r; Value:MBS("CURL.SetOptionQuote"; $curl; "DELE images/test.jpg")]
#run transfer
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
#get debug messages
Set Field [CURL Test::debug; MBS("CURL.GetDebugAsText"; $curl)]
Set Variable [$result; Value:MBS("CURL.Cleanup"; $curl)]

Move file on SFTP in done folder with variables and quotes:

MBS("CURL.SetOptionQuote"; $curl; "rename " & "\"" & $Path & $folder & "/" & $$FileName & "\"" & " " & "\"" & $Path & $folder & "Done/"
& $$FileName & "\"")

Change file permissions via SFTP:

# set permissions to 777, so everyone can read/write/execute the file.
Set Variable [ $result ; Value: MBS( "CURL.SetOptionQuote"; $curl; "chmod 777 /Users/cs/Pictures/test.jpg" ) ]

Change file owner group via SFTP:

# change group to group 20
Set Variable [ $result ; Value: MBS( "CURL.SetOptionQuote"; $curl; "chgrp 20 /Users/cs/Pictures/test.jpg" ) ]

Change file owner via SFTP:

# change owner to user 501
Set Variable [ $result ; Value: MBS( "CURL.SetOptionQuote"; $curl; "chown 501 /Users/cs/Pictures/test.jpg" ) ]

See also

Example Databases

Created 18th August 2014, last changed 12nd October 2018


CURL.SetOptionPut   -   CURL.SetOptionRTSPClientCSEQ

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins