Display the last modified file in directory in cPanel ☑️

Display the last modified file in directory in cPanel ☑️

From the terminal (SSH):

grep -Ril "find /home/username/public_html/ -type f -mtime -2"

From a .php file:

<?php

$last=shell_exec('grep -Ril "find /home/username/public_html/ -type f -mtime -2"');

echo "<pre>$last</pre>";

?>

The output will be just a file name:

last modified file in cpanel

If you see a blank page after opening the php file in your browser, contact your hosting provider and ask theem to enable shell_exec

Written by
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.