Moving file from one dir to Another with Given Qualifier

Hi,

I want to Move files from one dir to another dir on same mount point.

The source dir may contain subdir or files within it.
Search the files or subfolder which is older then a given datetime .

Move the file recursively and after each successful move of file make an entry to log file.

I really Appreciate your help!

Does the script I use help?:

You may replace the secureMove function with a simple move statement (secureMove increments a counter in the filename should the same file exist in the destination folder already).

#!/usr/bin/bash
#Version: v0.2
#Date:    21th of October, 2009
LOG=1
DEBUG=0
WARN=1
LOGDIR="/opt/logs"
DESTDIR="/export/home/li"
debug()
{
    if [ "$DEBUG" = 1 ] ; then
        /usr/bin/logger -p local7.debug "FileMove:$1"
    fi
}
log()
{
    if [ "$LOG" = 1 ] ; then
        /usr/bin/logger -p local7.notice "FileMove:$1"
    fi
}
warn()
{
    if [ "$WARN" = 1 ] ; then
        /usr/bin/logger -p local7.warn "FileMove:$1"
    fi
}


echo

detect_os()
{
    OS=`uname`
    case $OS in
       Linux) debug "Detecting OS... Linux";;
       SunOS) debug "Detecting OS... Solaris";;
       *) log "Detecting OS... Unknown OS! Only Linux and Solaris are supported so far. Exiting..."; exit 0;;
    esac
}

define_procs()
{
    case $OS in
       Linux)
                ECHO=/bin/echo
                CAT=/bin/cat
                EGREP=/bin/egrep
                GREP=/bin/grep
                SED=/bin/sed
                TR=/usr/bin/tr
                AWK=/bin/awk
                FIND=/usr/bin/find
                XARGS=/usr/bin/xargs
                BC=/usr/bin/bc
                WC=/usr/bin/wc
                ;;
       SunOS)
                ECHO=/usr/bin/echo
                CAT=/usr/bin/cat
                EGREP=/usr/bin/egrep
                GREP=/usr/bin/grep
                SED=/usr/bin/sed
                TR=/usr/bin/tr
                CHOWN=/usr/bin/chown
                MV=/usr/bin/mv
                if [ -f /usr/xpg4/bin/awk ]
                then
                    AWK=/usr/xpg4/bin/awk
                else
                    AWK=/usr/bin/awk
                fi
                FIND=/usr/bin/find
                XARGS=/usr/bin/xargs
                BC=/usr/bin/bc
                WC=/usr/bin/wc
                EXPR=/usr/bin/expr
                CP=/usr/bin/cp
                ;;
    esac
}

secureMove(){
    FILE="$1"
    DESTFILE=$FILE
    COUNTER=`$ECHO $FILE | sed -e 's/\.log$//;s/.*-//g'`

    debug "Current counter value is $COUNTER"

    while [ -f "${DESTDIR}/${DESTFILE}" -o -f "${DESTDIR}/retrieved.${DESTFILE}" ]
    do
        debug "File ${DESTDIR}/(retrieved.)${DESTFILE} exists already. Incrementing counter..."
        COUNTER=`$EXPR $COUNTER + 1`;
        DESTFILE=`$ECHO $DESTFILE | $SED -e "s/[^-][0-9]*\.log$/${COUNTER}\.log/"`
        debug "...new filename $DESTFILE"
    done

   $CHOWN li:li "${FILE}"
   $MV "${FILE}" "${DESTDIR}/${DESTFILE}"
    if [ $? = 0 ]; then
        log "$FILE moved SUCCESSfully to ${DESTDIR}/${DESTFILE}";
    else
        warn "FAILED to move file $FILE!!";
    fi
}

processFile(){
    FILE="$1"
    # make sure file exist and readable
    if [ ! -f $FILE ]; then
        warn " $FILE does not exists"
        exit 1
    elif [ ! -r $FILE ]; then
        warn " Unable to read $FILE"
        exit 2
    fi
    secureMove $FILE
}

processDir(){
    DIR=$1
    filecount=`$FIND ${DIR} -name "*ACCOUNTING*\-*\-*.log" -print | $WC -l | $TR -s '[:space:]' -`
    log "moving ${filecount} accounting files from ${DIR} to ${DESTDIR}"
    cd $LOGDIR
    for FILE in `/usr/bin/ls -1 *ACCOUNTING*\-*\-*.log`
    do
        processFile $FILE
    done
}

detect_os
define_procs
processDir $LOGDIR

1st of all thanks for your prompt reply.I am new to this scripting world and for me the script looks complex.
sorry about that.

so I have broken my requirement into part :

if you or someone can help me :

1.find and list out all files older then some predefined value within subdir and dir .

e.g:

Below are the files which met the condn
/usr/home/dir1
/subdir/sbdirfile1.txt
/sbdirfile2.txt
/sbdirfile3.txt

 / dirfile1.txt
 / dirfile2.txt
 / dirfile3.txt

now log1.txt should display

/usr/home/dir1/subdir/sbdirfile1.txt
/usr/home/dir1/subdir/sbdirfile2.txt
/usr/home/dir1/subdir/sbdirfile3.txt
/usr/home/dir1 / dirfile1.txt
/usr/home/dir1 / dirfile2.txt
/usr/home/dir1 / dirfile3.txt

Thanking you all in advance

Hope i am clear this time