Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

CURL.SetOptionFTPCreateMissingDirs

Whether to create missing directories.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 2.5 Yes Yes Yes Yes Yes

MBS( "CURL.SetOptionFTPCreateMissingDirs"; Handle; Value )

Parameters

Parameter Description Example value
Handle The CURL session handle. $curl
Value Whether to create missing directories. (1, 2 or 0) 2

Result

Returns "OK" on success.

Description

Whether to create missing directories.
Pass a number. If the value is 1, curl will attempt to create any remote directory that it fails to CWD into. CWD is the command that changes working directory.

This setting also applies to SFTP-connections. curl will attempt to create the remote directory if it can't obtain a handle to the target-location. The creation will fail if a file of the same name as the directory to create already exists or lack of permissions prevents creation.

Starting with 7.19.4, you can also set this value to 2, which will make libcurl retry the CWD command again if the subsequent MKD command fails. This is especially useful if you're doing many simultanoes connections against the same server and they all have this option enabled, as then CWD may first fail but then another connection does MKD before this connection and thus MKD fails but trying CWD works!

Examples

Upload via FTP with creation of missing folders:

Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; "ftp://ftp.monkeybreadsoftware.net/missingFolder/hello.txt") ]
# create any missing folders when uploading
Set Variable [ $result ; Value: MBS("CURL.SetOptionFTPCreateMissingDirs"; $curl; 1) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUsername"; $curl; CURL Test::Name) ]
# we upload some text here.
Set Variable [ $result ; Value: MBS("CURL.SetInputText"; $curl; "Hello World!") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUpload"; $curl; 1) ]
# Run transfer
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
# Check debug messages for errors
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Cleanup"; $curl) ]

Upload via SFTP and create missing diretories:

Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; "sftp://ftp.monkeybreadsoftware.net/missingFolder/hello.txt") ]
# create any missing folders when uploading
Set Variable [ $result ; Value: MBS("CURL.SetOptionFTPCreateMissingDirs"; $curl; 1) ]
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 ) ]
# we upload some text here.
Set Variable [ $result ; Value: MBS("CURL.SetInputText"; $curl; "Hello World!") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUpload"; $curl; 1) ]
# Run transfer
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
# Check debug messages for errors
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Cleanup"; $curl) ]

See also


CURL.SetOptionFTPAlternativeToUser   -   CURL.SetOptionFTPFileMethod

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins