WP_Filesystem_FTPext::exists() – Checks if a file or directory exists.

You appear to be a bot. Output may be restricted

Description

Checks if a file or directory exists.

Usage

$bool = WP_Filesystem_FTPext::exists( $path );

Parameters

$path
( string ) required – Path to file or directory.

Returns

bool Whether $path exists or not.

Source

File name: wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php


Lines:

1 to 10 of 10
  public function exists( $path ) {
    $list = ftp_nlist( $this->link, $path );

    if ( empty( $list ) && $this->WP_Filesystem_FTPext::is_dir( $path ) ) {
      return true; // File is an empty directory.
    }

    return ! empty( $list ); // Empty list = no file, so invert.
  }
 

 View on GitHub View on Trac