Decimating DirectoriesWhenever you set up some automated system that produces files, there's always that nagging fear that you'll forget about it and it will run rampant, filling up your hard drive with clutter. One good example is using
motionas a security system - you want to keep the most recent video clips in case you need to refer back to them, but there's little point in keeping the oldest ones.
Keeping only the most recent
nvideos and deleting the rest could be problematic, because the individual files could be large. Keeping anything younger than a certain number of days is no good, because there could be a burst of activity that creates a lot of files. So we want to make a script that will trim a directory of files down to a specific size.