Delete a file.
remove_file(path)
path (string) - File path or wildcard pattern to delete, relative to the script's directorynil
* (match any characters) and ? (match single character)** (recursive wildcard)*.log, temp_?.txt, data/*.jsonDelete a file:
remove_file("temp.txt")
print("Temp file deleted")
Clean up old logs:
for i = 1, 5 do
path = "logs/old_" + i + ".log"
if file_exists(path) then
remove_file(path)
end
end