systemd tmpfiles.d
can be used to manage temporary files/directories rather than using a cron.
Configurations should be stored in /etc/tmpfiles.d/*.conf
and /usr/lib/tmpfiles.d/*.conf
.
To clear all files in a directory that are older than 1 day create the file /etc/tmpfiles.d/clean_directory.conf
with this content:
#Type Path Mode User Group Age Argument
d /directory/to/manage - - - 1d
If the directory does not exist it will be created.