I'm running a php script via command line, and it works just fine, except that when it's finished, it doesn't go back to the command line? Just sits there, so I never when it's done...
This is the script:
$conn_id = ftp_connect(REMOTE)
or die("Couldn't connect to ".REMOTE);
$login_result = ftp_login($conn_id, 'OMITTED','OMITTED');
if ((!$conn_id) || (!$login_result))
die("FTP Connection Failed");
$dir = 'download';
if ($dir != ".") {
if (ftp_chdir($conn_id, $dir) == false) {
echo ("Change Dir Failed: $dir<BR>\r\n");
return;
}
if (!(is_dir($dir)))
mkdir($dir);
chdir ($dir);
}
$contents = ftp_nlist($conn_id, ".");
foreach ($contents as $file) {
if ($file == '.' || $file == '..')
continue;
if (@ftp_chdir($conn_id, $file)) {
ftp_chdir ($conn_id, "..");
ftp_sync ($file);
}
else
ftp_get($conn_id, $file, $file, FTP_BINARY);
}
ftp_chdir ($conn_id, "..");
chdir ("..");
ftp_close($conn_id);