Yes, you can do it in pure PHP!
I just released two new libraries to do such things in FTP / SFTP
Recursively copy files and folders to a remote SFTP server (if local_path ends with the contents of a slash folder, otherwise the folder itself loads)
Ftp::upload_dir($server, $user, $password, $local_path, $remote_path, $port = 22);
Download the directory from the remote FTP server (if remote_dir ends with the contents of the folder with a slash directory, otherwise load the folder)
Ftp::download_dir($server, $user, $password, $remote_dir, $local_dir,
$ port = 22);
If you want to look at the code, you will see recursive functions that do magic;)
source share