I'm trying to solve a problem with rotating binary files.
I have video files which are recorded from IP camera, and I want to delete oldest files when I have less then e.g. 10 Gb of free space.
Files are named in %Y%m%d%H%M%S.h264 format, for example 20150624123600.h264.
First I was thinking of using logrotate for that, but with config
/data/video/.h264 {
rotate 20
nocompress
dateext
dateformat %Y%m%d%H%M%S
extension .h264
missingok
}
I get message log /data/video/.h264 does not exist -- skipping while files like /data/video/20150624123600.h264 are exist. I also tried to add prefix, but it didn't help.
Could you help me with solving this problem - deleting oldest files (according to the date in file name) when free space limit is reached? It could be just bash script or logrotate config, or anything that could be run on ubuntu server.