WP_Filesystem_FTPext::exists( string $path )
Checks if a file or directory exists.
Parameters
- $path
-
(Required) Path to file or directory.
Return
(bool) Whether $path exists or not.
Source
File: wp-admin/includes/class-wp-filesystem-ftpext.php
public function exists($file) {
$list = @ftp_nlist($this->link, $file);
if ( empty( $list ) && $this->is_dir( $file ) ) {
return true; // File is an empty directory.
}
return !empty($list); //empty list = no file, so invert.
}
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |