The question you need to address is "how do you know when the drive is full", presumably the files are of varying size, so you cannot predict when another file will be able to fit on the drive or not.
I would suggest you change you strategy slightly and have a configuration setting, such as
"Keep files for X days"
You can then just do a file search, decode the date, compare it to the current date, and if it is over the setting then delete the file
Main Topics
Browse All Topics





by: AmigoJackPosted on 2006-09-07 at 00:19:08ID: 17468688
thats quite a simple task: do findfirstfile and findnextfile recursively, compare the filetime and if its the oldest, remember that and the filename. once youre through, you have the oldest one and can delete it.
now comes the precision in: which file is the "oldest" one? the one with the oldest modification or the one with the oldest creation date? i would tend to creation date. but more comes to my mind: per analyzing should only ONE file be deleted?