On linux, this works:
D=`stattimestamp=$(stat -c %y foldername`foldername)
mv foldername new_foldername
touch -d "$D""$timestamp" new_foldername
This is usually faster.
Explanation:The stat -c %y givescommand returns the modification date of the folder, in readable form. That value is retained and used with the command touch -d "$D""$timestamp" to set the time of the new folder.