Hi, I’m using the X20CP0484 CPU and have a USB connected to it.
CPU storing log files on the USB, and due to storage limitations, I have added a function to delete the oldest files when necessary.
I’m currently using DirOpen and DirReadEx functions to read files, but since there are a lot of files on the USB, the process takes too long.
Is there a function that allows me to read the oldest files first?
Or is there another way to store files on USB in a FIFO (First-In, First-Out) format?
Thanks in advance!
It seems that reading the oldest files first is not easy because USB uses the FAT32 system.
Is there a way to store files on the USB for a long time?
I just need the old files to be deleted automatically.
a) you could replace storing log files manually with the integrated logger: ArEventLog
b) Restructure your logging so it logs into an own folder which you can then search easier / in less time?
c) An actual solution: Store an additional file containing the files (or a distinct part of the filename instead of the whole thing, to save memory) in ascending order, append new files at the end and remove old ones from the beginning whenever you delete them.
My question is, is this just excessive logging for logging’s sake or is this actually useful - as in will anyone ever look at 20k files of logging.
Maybe you can change this by not removing files only when you are running out of memory but make it some kind of FiFo with a (reasonable) limit of files kept. That way you can keep your approach with DirReadEx, iterating over only a few (10? 20? 100?`- anything far from the current 20k files).
Benefit should be reduced wear on the storage, easier manual navigation when using the logfiles for anything, easier automated handling of them, …