Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.SetOptionQuote
Sets the list of FTP or SFTP commands to pass to the server prior to your FTP request.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
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.
Paths can have quotes for spaces. Use either double or single quotes.
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.
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.
Please repeat Value parameter as often as you need.
See also QUOTE option in CURL manual.
Examples
Delete file only with FTP:
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 for FTP:
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.com/")]
# 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.GetDebugMessages"; $curl)]
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]
Move file on SFTP in done folder with variables and quotes:
MBS("CURL.SetOptionQuote"; $curl;
// first delete
"rm " & "\"" & $Path & $folder & "Done/" & $$FileName & "\"";
// then move
"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" ) ]
Rename file after upload for SFTP:
Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $result ; Value: MBS( "CURL.SetOptionURL"; $curl; "sftp://test.com/folder/temp.jpg") ]
# credentials
Set Variable [ $result ; Value: MBS( "CURL.SetOptionPassword"; $curl; CURL Test::Password) ]
Set Variable [ $result ; Value: MBS( "CURL.SetOptionUserName"; $curl; CURL Test::Name) ]
Set Variable [ $result ; Value: MBS( "CURL.SetOptionSSHAuthTypes"; $curl; 2+8 ) ]
# data to upload from container field
Set Variable [ $result ; Value: MBS("CURL.SetOptionUpload"; $curl; 1) ]
Set Variable [ $result ; Value: MBS("CURL.SetInputFile"; $curl; CURL Test::Image) ]
Set Variable [ $result ; Value: MBS("CURL.SetInputFile"; $curl; CURL Test::Image) ]
# Require TLS 1.2 for FTP over SSL:
Set Variable [ $result ; Value: MBS( "CURL.SetOptionUseSSL"; $curl; 3 ) ]
Set Variable [ $result ; Value: MBS( "CURL.SetOptionSSLVersion"; $curl; 6 ) ]
# download existing file, rename after upload
Set Variable [ $result ; Value: MBS( "CURL.SetOptionPostQuote"; $curl; "*rm image.jpg"; "rename temp.jpg image.jpg" ) ]
# see progress in debug messages
Set Variable [ $result ; Value: MBS( "CURL.SetDebugWithProgress"; $curl; 1 ) ]
# perform it
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugMessages"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]
Create folder with SFTP:
MBS( "CURL.SetOptionQuote"; $curl; "mkdir 'Backups/today'" )
See also
- CURL.GetOptionQuote
- CURL.SetOptionPostQuote
- CURL.SetOptionPreQuote
- CURL.SetOptionPut
- CURL.SetOptionRange
- CURL.SetOptionSSHAuthTypes
- CURL.SetOptionSSLVersion
- CURL.SetOptionUpload
- CURL.SetOptionURL
- CURL.SetOptionVerbose
Example Databases
Blog Entries
- Translating Insert from URL options for CURL to MBS Plugin calls
- Comparing Base Elements Plugin to MBS FileMaker Plugin
Created 18th August 2014, last changed 18th January 2024