Hi
I'm trying to prune some files because they're getting huge
they're not txt files but .db files, but i guess that doesn't matter as they also just have plain text in them
when new lines get added to those files they go to the top, so the oldest data is at the bottom
now i'd only need the 400 newest lines to stay there, everything after can be deleted.
The tricky part is probably that some files don't have 400 lines in them yet, so nothing needs to be deleted there.
there's over 1700 of these files in a directory, so it would be best if the script does all of them
i guess i can do that with
$dirname = "inc";
$dh = opendir("$dirname") or die("Couldn't do it");
while ( $file = readdir($dh) ) {
if ($file == ".." || $file == ".") continue;
and then open $file each time
can somebody please help me with the deleting after 400th line thing ?
thank you 😉