My company's program generates lots of data with many different file types. One of them, .log
file type uses much space and since I do not need log files I would like to remove them as soon as the program creates them. Unfortunatelly I cannot disable log creation option, as the program simply does not offer such an option. I wonder: is running find
with -delete
option in a while true
loop best option, or is there any better/recommended option?
while true
do
find -type f -name "*.log" -delete
done
You could use
incrond
daemon to listen filesystem changes and delete file when it appears or just use cron to delete *.log files in every minute as more simpler solution.