#!/bin/bash
#
# Cleanup of ftp are for mageia-docker content
#
# This is were we store the files
cd ~ftp/mageia-docker

# We want to keep that many files
KEEP=5

# for each distro...
for v in *; do
	c=`ls $v | wc -l`
	c2=$(($c - $KEEP))
	if [ $c2 -gt 0 ]; then
		rm -f `ls -tr $v/* | head -$c2`
	fi
done
