Internal storage – Free up space, automatically

Is there a way to run "free space" automatically or at certain intervals, such as a cron job?

I use one of my phones as an in-car camera, which writes the videos to the photo library, which are then saved by Google Photos on Google Drive. I periodically need to open the phone and "free up space". Could this be done automatically?