Sinisa wrote:
>
> Hi,
>
> I am trying to make a script that would run every couple hours and purge all
> files in certain folder except last five files (most recent).
> Files are being added to that folder constantly.
>
> Can you help me ?
Here's one solution:
cd /whereever
n=5 # save $n most recent
set -- `/bin/ls -t`
if test $# -gt $n
then
shift $n
/bin/rm -f "$@"
fi
--
Roger Cornelius
racpop@tenzing.org