I’m tired writing scripts to clean up temporary files.
It’s a nigh trivial task. The chance for error is small, but the consequences can be dire!
I wrote a little utility that makes this a little easier. It simply deletes all the files in a folder (recursive or no) that are older than a specified number of seconds.
Example Usage:
// no init needed, but the function's there if you like
fileSweeper = CreateObject("component", "fileSweeper");
// all arguments are actually defaulted to the values shown
// so you needn't pass any, fancy eh?
fileSweeper.deleteOldFiles(
folder = ExpandPath("/temp"),
seconds = 600,
filter = "*.*",
recurse = "no",
lockname = "deleteFiles",
timeout = 60,
logging = true
);
