I'm running a script on a group of mint/ubuntu VMs that every weeks downloads exactly 23 files, elaborates them one at time, and creates one big file (1..3 GB) for each downloaded file.
Downloaded files are in a folder, and elaborated files are in a different one folder.
Because the sript handle one downloaded file at time, creating one single new elaborated file, I'd like, at end of elaboration, to delete the oldest files automatically, in both folders.
My idea was to list folder content sorted by modified time descending, and to delete file starting from 24th.
Is it possibile to realize this using bash (so I can cron it) ?