FolderManager

FolderManager

Provides the APIs for managing folders in CompleteFTP. Instances of this class should be obtained using Config.folders.

Methods

add(path, type, mappingPath) → {Folder}

Description:
  • Adds a folder of the given type.

Source:
Parameters:
Name Type Description
path String

Absolute path of the folder in the virtual file-system.

type String

Type of the folder. Currently, the following types are supported:

  • 'VirtualFolder'
  • 'WindowsFolder'
  • 'WindowsSpecialFolder'
  • 'NetworkMacroFolder'
mappingPath String

Controls how the folder is mapped to the underlying file-system.
Notes:

  • This parameter is not required for Virtual folders.
  • For Windows folders and Network/Macro folders, mappingPaths are Windows file-system paths. In addition, Network/Macro folders' mappingPaths may include macros (listed below) or an environment variable.
    • %UserName% - User-name (without domain).
    • %DomainName% - Domain name.
    • %HomeBaseFolder% - Windows path of Home folder (i.e. parent of users' home folders).
    • %ExternalHomeFolder% - [Database users only] Path read from user database.
  • For Windows special folders, valid values should be:
    • 'Home' (User's home folder)
    • 'Personal' (User's My Documents folders)
    • 'DesktopDirectory' (User's Desktop folder)
    • 'MyPictures' (User's Pictures folder)
    • 'MyMusic' (User's My Music folder)
Returns:

A Folder object for the added folder.

Type
Folder

get(path) → {Folder}

Description:
  • Returns a Folder object for the given path.

Source:
Parameters:
Name Type Description
path String

Absolute path of the folder in virtual file-system.

Returns:
Type
Folder

list() → {Array.<Folder>}

Description:
  • Returns an array of Folder objects representing all root folders in the virtual file-system including inbuilt ones.

Source:
Returns:
Type
Array.<Folder>

listAll() → {Array.<Folder>}

Description:
  • Returns an array of Folder objects representing all folders in the virtual file-system regardless of their location in the folder-tree including inbuilt ones.

Source:
Returns:
Type
Array.<Folder>

listWindowsDirectory(path, includeFilesopt) → {Array.<WindowsFile>}

Description:
  • Returns a listing of the given Windows folder (in the Windows file-system) in the form of an array of WindowsFile objects.

Source:
Parameters:
Name Type Attributes Default Description
path String

Absolute path of the folder in the Windows file-system.

includeFiles Boolean <optional>
false

If true, files within the folder are also included.

Returns:
Type
Array.<WindowsFile>

move(folder, parentFolder)

Description:
  • Moves the given folder to another path.

Source:
Parameters:
Name Type Description
folder String | Folder

Virtual file-system path or Folder object of the folder to be moved.

parentFolder String | Folder

Virtual file-system path or Folder object of the folder to move it to. Note that to move the folder to root level, this parameter needs to be set to '/'.

remove(folder, recursiveopt)

Description:
  • Deletes the given folder.

Source:
Parameters:
Name Type Attributes Default Description
folder String | Folder

Virtual file-system path or Folder object of the folder to be deleted.

recursive Boolean <optional>
false

If true, the folder will be deleted recursively.