Problem statement
Many a times we want to have automatic cleaning mechanism for oldest file to create more space for new files. It is very useful when we no longer require old files.
Solution
DeleteOldestFile(provide the path)
{
Call FindFirstFile
If Success
{
Check if it is not directory else skip
Compare timing of files
Swap files to local variable keeping point of oldest file if local variable timing is newer then current file timing
Call FindFileNext
If not success, close handle and break
}
}
No comments:
Post a Comment