# ``twisted`.`protocols`.`ftp`.`IFTPShell``

interface documentation

`class IFTPShell(Interface): (source)`

Known implementations: `twisted.protocols.ftp.FTPAnonymousShell`

View In Hierarchy

An abstraction of the shell commands used by the FTP protocol for a given user account.

All path names must be absolute.

Method | `access` | Determine whether access to the given path is allowed.
Method | `list` | Retrieve information about the given path.
Method | `makeDirectory` | Create a directory.
Method | `openForReading` |
Method | `openForWriting` |
Method | `removeDirectory` | Remove a directory.
Method | `removeFile` | Remove a file.
Method | `rename` | Rename a file or directory.
Method | `stat` | Retrieve information about the given path.

def access(path): (source)
Determine whether access to the given path is allowed.

Parameters
path | The path, as a list of segments
Returns
A Deferred which fires with None if access is allowed or which fails with a specific exception type if access is denied.

def list(path, keys=()): (source)

Retrieve information about the given path.

If the path represents a non-directory, the result list should have only one entry with information about that non-directory. Otherwise, the result list should have an element for each child of the directory.

Parameters
path:`list` of `unicode` or `bytes` | The path, as a list of segments, to list
keys | A tuple of keys desired in the resulting dictionaries.
Returns

A Deferred which fires with a list of (name, list), where the name is the name of the entry as a unicode string or bytes and each list contains values corresponding to the requested keys. The following are possible elements of keys, and the values which should be returned for them:

- `'size'`: size in bytes, as an integer (this is kinda required)
- `'directory'`: boolean indicating the type of this entry
- `'permissions'`: a bitvector (see os.stat(foo).st_mode)
- `'hardlinks'`: Number of hard links to this entry
- `'modified'`: number of seconds since the epoch since entry was modified
- `'owner'`: string indicating the user owner of this entry
- `'group'`: string indicating the group owner of this entry

def makeDirectory(path): (source)
Create a directory.

Parameters
path:`list` of `unicode` | The path, as a list of segments, to create
Returns
A Deferred which fires when the directory has been created, or which fails if the directory cannot be created.

def openForReading(path): (source)

Parameters
path:`list` of `unicode` | The path, as a list of segments, to open
Returns
`Deferred` which will fire with `IReadFile` | Undocumented

def openForWriting(path): (source)

Parameters
path:`list` of `unicode` | The path, as a list of segments, to open
Returns
`Deferred` which will fire with `IWriteFile` | Undocumented

def removeDirectory(path): (source)
Remove a directory.

Parameters
path:`list` of `unicode` | The path, as a list of segments, to remove
Returns
A Deferred which fires when the directory has been removed, or which fails if the directory cannot be removed.

def removeFile(path): (source)
Remove a file.

Parameters
path:`list` of `unicode` | The path, as a list of segments, to remove
Returns
A Deferred which fires when the file has been removed, or which fails if the file cannot be removed.

def rename(fromPath, toPath): (source)
Rename a file or directory.

Parameters
fromPath:`list` of `unicode` | The current name of the path.
toPath:`list` of `unicode` | The desired new name of the path.
Returns
A Deferred which fires when the path has been renamed, or which fails if the path cannot be renamed.

def stat(path, keys=()): (source)

Retrieve information about the given path.

This is like list, except it will never return results about child paths.