#!/bin/bash

RELOCATE_AFTER_DAYS=5
REMOVE_AFTER_DAYS=30


find /srv/ftp/incoming -maxdepth 1 -type f -mtime +$RELOCATE_AFTER_DAYS | while read line; do
        mv "$line" /srv/ftp/incoming/attic/
done

find /srv/uploads -maxdepth 1 -type f -mtime +$RELOCATE_AFTER_DAYS | while read line; do
        mv "$line" /srv/uploads/attic/
done

find /srv/sftp/incoming -maxdepth 1 -type f -mtime +$RELOCATE_AFTER_DAYS | while read line; do
        mv "$line" /srv/sftp/incoming/attic/
done


find /srv/ftp/incoming/attic -maxdepth 1 -type f -mtime +$REMOVE_AFTER_DAYS | while read line; do
        rm "$line"
done

find /srv/uploads/attic -maxdepth 1 -type f -mtime +$REMOVE_AFTER_DAYS | while read line; do
        rm "$line"
done

find /srv/sftp/incoming/attic -maxdepth 1 -type f -mtime +$REMOVE_AFTER_DAYS | while read line; do
        rm "$line"
done