The below function is used to rename the existing file before checking in the directory.
For the first time it will copy and from second time onwords it will rename with SYSDATE.
function COPYFILE
{
[[ -f "$2/$1" ]] && mv "$2/$1" "$2/$1".$(date '+%d%m%Y')
cp "$1" "$2"
}
COPYFILE XYZ.rdf $AR_TOP/reports/US
For the first time it will copy and from second time onwords it will rename with SYSDATE.
function COPYFILE
{
[[ -f "$2/$1" ]] && mv "$2/$1" "$2/$1".$(date '+%d%m%Y')
cp "$1" "$2"
}
COPYFILE XYZ.rdf $AR_TOP/reports/US