Date Stamp -1

I need to move files after midnight but attach the previous date to it.

Moving files before midnight no proproblem but how can I move files which are created on the 22nd for example but add a date stamp of previous day?

Date ='date +"Y%m%d"' gets today's date but how can I get yesterday's date.

Thanks

there is a datecal program by perderabo on the forum. Search for that. I havent personally used as I never had a need to so far. But have read thru the forums so many times and all praises for it :). So go ahead and use it. Here is the link

http://www.unix.com/showthread.php?p=16559\#post16559

Use the following script to get previous day's date.

#! /usr/bin/ksh
# Get yesterday's date in YYYY-MM-DD format.
# With argument N in range 1..28 gets date N days before.

OFFSET=${1:-1}

case $OFFSET in
*[!0-9]* | ???* | 3? | 29) print -u2 "Invalid input" ; exit 1;;
esac

eval `date "+day=%d; month=%m; year=%Y`
typeset -Z2 day month
typeset -Z4 year

# Subtract offset from day, if it goes below one use 'cal'
# to determine the number of days in the previous month.
day=$((day - OFFSET))
if (( day <= 0 )) ;then
month=$((month - 1))

    if \(\( month == 0 \)\) ;then
            year=$\(\(year - 1\)\)
            month=12
    fi

    set -A days \`cal $month $year\`
    xday=$\{days[$\(\( $\{\#days[*]\}-1 \)\)]\}
    day=$\(\(xday \+ day\)\)

fi
print $year-$month-$day

simply just try :
date -d -1day
date -d -1day '+%Y%m%d'
date -d yesterday '+%Y%m%d'