What would be the best way to scan a remote directory’s filenames using only PHP?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I use a recurrence function:
function getDirectoryTree ( $outerDir, $x ) { $dirs = array_diff ( scandir ( $outerDir ), Array ( ".", ".." ) ); foreach ( $dirs as $d ) { if ( is_dir ( $outerDir . "/" . $d ) ) { getDirectoryTree ( $outerDir . "/" . $d, $x ); } else { if ( ($x) ? ereg ($x . '$', $d) : 1 ) { $ftime = @filemtime ( $outerDir . '/' . $d ); if ( ( $ftime !== FALSE ) && ( $ftime > time ( ) - 60*60*24*5 ) ) { echo date ('Y-m-d H:i', $ftime ) . ' ' . $outerDir . '/' . $d . '<BR>'; } } } } } getDirectoryTree ( '../', 'php' );It show (echo) all php files what was changed in last 5 days…
And be easily adjust to your needs