First we Need a helper file
# Create helper file for > 5 min
echo -e "INFO : Create helper-file $HELPER1 for folders older than 5 min on $SRC"
touch -t `date -d "-5 minutes" +"%Y%m%d%H%M"` $HELPER1
#echo -e "DEBUG : Helper file created $HELPER1"
after creating a helper file we can work with files or folders older than 5 min
# check for new folders in $SRC
if [ "$(ls -A $SRCDIR)" ]; then
echo -e "INFO : $SRC Is not Empty"
echo -e "INFO : Find all folder older than 5 min and move from $SRC to $DEST"
for i in `find . -type d ! -newer $HELPER1`;do
mv $i $DESTDIR
to find newer files use
for i in `find . -type d -newer $HELPER1`;
for i in `find . -type d ! -newer $HELPER1`;