Note: This API documentation is for FAKE version 4. The migration API documentation can be found here. The API documentation for the new fake 5 modules can be found here

FtpHelper

Contains helpers which allow to upload a whole folder/specific file into a FTP Server. Uses Passive Mode FTP and handles all files as binary (and not ASCII). Assumes direct network connectivity to destination FTP server (not via a proxy). Does not support FTPS and SFTP.

Nested types and modules

TypeDescription
FtpServerInfo

Functions and values

Function or valueDescription
createAFolder server user pwd destPath
Signature: server:string -> user:string -> pwd:string -> destPath:string -> unit

Creates a matching folder in FTP folder, if not already present.

Parameters

  • destPath - The full name of folder which needs to be created, including all its parent folders
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")
deleteAFile server user pwd destPath
Signature: server:string -> user:string -> pwd:string -> destPath:string -> unit

Deletes a single file from remote FTP folder.

Parameters

  • destPath - The full path to the file which needs to be deleted, including all its parent folders
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")
deleteAFolder server user pwd destPath
Signature: server:string -> user:string -> pwd:string -> destPath:string -> unit

Deletes a single folder from remote FTP folder.

Parameters

  • destPath - The full path to the folder which needs to be deleted, including all its parent folders
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")
getFtpDirContents(...)
Signature: server:string -> user:string -> pwd:string -> dirPath:string -> string

Gets the contents/listing of files and folders in a given FTP server folder

Parameters

  • dirPath - The full name of folder whose content need to be listed
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")
getServerInfo(...)
Signature: serverNameIp:string -> user:string -> password:string -> ftpMethod:string -> FtpServerInfo

Gets a connection to the FTP server

isFolderPresent server user pwd destPath
Signature: server:string -> user:string -> pwd:string -> destPath:string -> bool

Given a folder path, will check if that folder is present at a given root directory of a FTP server.

Parameters

  • destPath - The full name of folder which needs to be checked for existance, including all its parent folders
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")
regexCheck fname ftpContents
Signature: fname:string -> ftpContents:string -> bool

Checks to see if the ftp content string containts the string Given_Folder_Name

uploadAFile(...)
Signature: server:string -> user:string -> pwd:string -> destPath:string -> srcPath:string -> unit

Uploads a single file from local directory into remote FTP folder.

Parameters

  • destPath - The full local file path that needs to be uploaded
  • srcPath - The full path to file which needs to be created, including all its parent folders
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")
uploadAFolder(...)
Signature: server:string -> user:string -> pwd:string -> srcPath:string -> rootDir:string -> unit

Uploads a given local folder to a given root dir on a FTP server.

Parameters

  • srcPath - The local server path from which files need to be uploaded
  • rootDir - The remote root dir where files need to be uploaded, leave this as empty, if files need to be uploaded to root dir of FTP server
  • server - FTP Server name (ex: "ftp://10.100.200.300:21/")
  • user - FTP Server login name (ex: "joebloggs")
  • pwd - FTP Server login password (ex: "J0Eblogg5")