At this moment i'm logging alarms in a file on the plc
but I want to limit the maximum file size
to avoid the problem that the plc runs out of disk space
So when the file reaches the maximum file size and I want to apend a new text line to the file I want also
remove the oldest (first text line in the file ), first in first out principle
Is this posible ??
And can sombody give me a hint
kind regards
Merlijn
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
first i scan the directory and save from all file's in that directory the name, creation date and the size in a array
and find out witch file is the newest and witch file is the oldest and how big the directory is
then i check or the newest file is bigger then the maximum size set
if that is the case i create a new file with a name based on the system time Example ( 2013-08-08-09-47-25.log )
after that i check or the directory has reached the maximum size set ithat is the case
I will delete the oldest files
to do this i use the library's syslibfile.lib and the library syslibdir.lib
but thanks for your support
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
At this moment i'm logging alarms in a file on the plc
but I want to limit the maximum file size
to avoid the problem that the plc runs out of disk space
So when the file reaches the maximum file size and I want to apend a new text line to the file I want also
remove the oldest (first text line in the file ), first in first out principle
Is this posible ??
And can sombody give me a hint
kind regards
Merlijn
two ways to do this.
make a file and when reaching max size start another file, when this reaches the end start filling file 1 again.
another way is by removing last line while copying and adding first line.
this means always diskactivity.
hello Shooter
I solved the problem
first i scan the directory and save from all file's in that directory the name, creation date and the size in a array
and find out witch file is the newest and witch file is the oldest and how big the directory is
then i check or the newest file is bigger then the maximum size set
if that is the case i create a new file with a name based on the system time Example ( 2013-08-08-09-47-25.log )
after that i check or the directory has reached the maximum size set ithat is the case
I will delete the oldest files
to do this i use the library's syslibfile.lib and the library syslibdir.lib
but thanks for your support