Q . How to check using PHP FTP functionality if folder exists on remote server?

Mike Tyson. asked, Feb 18 ' 2017

Is there a way to check if a a folder exists on the remote server using PHP Ftp functionality?

  • ftp
  • is_dir
  • remote-server

1 Answers

For PHP 5:

$folder_exists = is_dir('ftp://user:password@example.com/some/dir/path');

http://php.net/manual/en/function.is-dir.php : "As of PHP 5.0.0, this function can also be used with some URL wrappers."

http://php.net/manual/en/wrappers.ftp.php : [Support] "As of PHP 5.0.0: filesize(), filetype(), file_exists(), is_file(), and is_dir()"

Leave a Ansewer