Is there a function in PHP which will clear out all the files in a specified folder? If there is no global solution I will use ftp_delete($conn_id, $file) I'm looking for a function which will clear out a folder daily with a CRON job.
Thanks for the suggestion. This is the solution I went with; <?php // set up basic connection $conn_id = ftp_connect('ftp.domain.com'); // login with username and password $login_result = ftp_login($conn_id, '<username>', '<password>'); $folder = '/public_html/directory/'; $contents = ftp_nlist($conn_id,$folder); for($i=2;$i<count($contents);$i++){ ftp_delete($conn_id,$folder . $contents[$i]); } // close the connection ftp_close($conn_id); ?> PHP: