First we Need a helper file
Code:
# Create helper file for > 5 min
helperFile1()
{
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"
}
helperFile1
after creating a helper file we can work with files or folders older than 5 min
Code:
# 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
done
to find newer files use
Code:
for i in `find . -type d -newer $HELPER1`;
instead of
Quote:
for i in `find . -type d ! -newer $HELPER1`;