This is part of the Fake.Net.FTP module.

FTP

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
FTP.createAFolder(...)
Signature: server:string -> user:string -> pwd:string -> destPath:string -> unit

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

Parameters

  • 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")
  • destPath - The full name of folder which needs to be created, including all its parent folders
FTP.deleteAFile server user pwd destPath
Signature: server:string -> user:string -> pwd:string -> destPath:string -> unit

Deletes a single file from remote FTP folder.

Parameters

  • 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")
  • destPath - The full path to the file which needs to be deleted, including all its parent folders
FTP.deleteAFolder(...)
Signature: server:string -> user:string -> pwd:string -> destPath:string -> unit

Deletes a single folder from remote FTP folder.

Parameters

  • 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")
  • destPath - The full path to the folder which needs to be deleted, including all its parent folders
FTP.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

  • 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")
  • dirPath - The full name of folder whose content need to be listed
FTP.getServerInfo(...)
Signature: serverNameIp:string -> user:string -> password:string -> ftpMethod:string -> FtpServerInfo

Gets a connection to the FTP server

FTP.isFolderPresent(...)
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

  • 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")
  • destPath - The full name of folder which needs to be checked for existence, including all its parent folders
FTP.isValidDirectoryName(directoryName)
Signature: directoryName:string -> bool

[omit] Partial validation for folder name, based on http://msdn.microsoft.com/en-us/library/aa365247.aspx

FTP.regexCheck folderName ftpContents
Signature: folderName:string -> ftpContents:string -> bool
Modifiers: inline

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

FTP.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

  • 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")
  • 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
FTP.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

  • 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")
  • 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