Move files and rename ??

  1. If I have a file-yyyymmdd.dat in a directory DATA1, then how do I move this file to directory DATA2 and the file name change to file-yyyymmdd.dat.currenttime

I can manual do this
$mv fileA-yyyymmdd.dat ./DATA2/fileA-yyyymmdd.dat.`date +%Y%m%d%H%M%S`
but how do I move all of the files in this directory to new DATA2 and rename it with an extension currenttime like file-yyyymmdd.dat..`date +%Y%m%d%H%M%S`

I dont want to do mannual one by one .

  1. If I want to move all file older than file-20060320.dat to DATA2 then what should I do with korn shell.
    Thanks .

one way.....

for file in *.dat
do
   mv "${file}" ./DATA2/"${file}".`date +%Y%m%d%H%M%S`
done

man find