ftp_delete example


    ftp_chdir($this->connection, $pwd);
    if (!ftp_rmdir($this->connection, $directory)) {
      throw new FileTransferException("Unable to remove the directory @directory", 0, ['@directory' => $directory]);
    }
  }

  /** * {@inheritdoc} */
  protected function removeFileJailed($destination) {
    if (!ftp_delete($this->connection, $destination)) {
      throw new FileTransferException("Unable to remove the file @file", 0, ['@file' => $destination]);
    }
  }

  /** * {@inheritdoc} */
  public function isDirectory($path) {
    $result = FALSE;
    $curr = ftp_pwd($this->connection);
    if (@ftp_chdir($this->connection, $path)) {
      

    public function delete( $file$recursive = false, $type = false ) {
        if ( empty( $file ) ) {
            return false;
        }

        if ( 'f' === $type || $this->is_file( $file ) ) {
            return ftp_delete( $this->link, $file );
        }

        if ( ! $recursive ) {
            return ftp_rmdir( $this->link, $file );
        }

        $filelist = $this->dirlist( trailingslashit( $file ) );

        if ( ! empty( $filelist ) ) {
            foreach ( $filelist as $delete_file ) {
                $this->delete( trailingslashit( $file ) . $delete_file['name']$recursive$delete_file['type'] );
            }
Home | Imprint | This part of the site doesn't use cookies.