#! /bin/bash for x in *.LOG *.log; do export z=`echo $x | cut -f 1 -d '.'` for y in `date "+%Y-%m-%d-%H%M"`; do export b=${y} mv ${x} ${z}${y}. done; done