I need a cron job that removes files larger than 50mb under the /tmp directory (checking every 10 minutes)
anyone can help?
Happy holidays.
I need a cron job that removes files larger than 50mb under the /tmp directory (checking every 10 minutes)
anyone can help?
Happy holidays.
You will probably need a script -- in perl or another language that you're familiar with. Basically it would do something like this:
1. Capture the output of ls -l.
2. Split that into lines.
3. Split each line into items - filename, filesize, owner, etc.
4. For each line, evaluate the filesize item to see if it is greater than the specified limit;
5. If yes, push the filename onto a new array.
6. Process the new array, deleting each file it contains.
But perhaps someone else has ideas....