Hi, I am currently manager of various content delivery services, including downloading images, audio, video, but 'm starting as freelancer.
I understand the need you have to remove the temporary files that are generated by the downloads on your site. In the same way that you plan to do it, I scheduled a programmed task through a cronjob to delete files depending on time and file type.
Really it not very complicated to do this task, but be careful not to delete other files.
In my experience, once configured the command, I recommend using an alternate directory with similar files and do the test, once the desired result is checked only the directory path is changed and put into production.
I can help you with this project,
Kind regards