This Linux command finds regular files whose modification times are more than X whole days old. Replace X with the number of days and /path/to/files with the directory to search. First preview the matching files:
find /path/to/files -type f -mtime +X -print
For example, to preview regular files last modified at least four whole days ago:
find /var/www/html -type f -mtime +3 -print
After checking the list, delete those matching files with:
find /var/www/html -type f -mtime +3 -exec rm -- {} \;
The -type f test restricts the command to regular files. The original example also matched directories and used rm -rf, which could remove newer files inside an older directory. This version does not recursively delete matched directories. The -mtime test uses modification time, not creation time, and rounds age down to whole 24-hour periods before comparing it.