#!/bin/bash
archivedir=/parablu/archive/mongodb_backup/
backupdir=/parablu/backup/mongodb/
numfiles=10

echo "running database archival script"
if [ ! -d "$archivedir" ];
then
        mkdir -p $archivedir 2>&1
fi

cd $backupdir
mv *.gz $archivedir
sleep 2
cd $archivedir
ls -t | sed -e "1, $numfiles d" | xargs -d '\n' rm
