remove: shortcut method to remove self.
        if 'self' represents a file, the backends 'removefile' method id used.
        if 'self' represents a directory, it will recursivly removed, if
        the options string contains 'r'. Otherwise, the backends 'removedir'
        method is used.

def remove(self, recursive=False):
        """
        remove: shortcut method to remove self.
        if 'self' represents a file, the backends 'removefile' method id used.
        if 'self' represents a directory, it will recursivly removed, if
        the options string contains 'r'. Otherwise, the backends 'removedir'
        method is used.
        """
        if self.connection.islink(self):
            return self.connection.removefile(self)

        if not self.connection.exists(self):
            raise FileDoesNotExistError(str(self))

        if self.connection.isdir(self):
            if recursive:
                return remove_dir_recursively(self.connection, self)
            else:
                return self.connection.removedir(self)
        elif self.connection.isfile(self):
            return self.connection.removefile(self)