Rename multiple file names in a directory

I hope some one can help me

I have multiple files in a directory with out extension like as below mentioned. But i want to change all the file names along .DDMMYYYYHHMISS format. And all files should have same DDMMYYYYHHMISS.

Scenario:

direcory name = /vol/best/srcfiles

files in a direcory

Payor
customer
vendor
Employee

I want the files names as below

Payor.05222011035216
customer.05222011035216
vendor.05222011035216
Employee.05222011035216

Thanks,

you can try this..

for file in *
do
mv $file $file.`date +%d%m%y%H%M%S`
done

Folks, use code tags.
I would also recommend using instead of

`code` with $(code)

for easier reading for code.

atul9806,

i have tried as mentioned below, which is not working. Can you please guide me with sed command

To match your requirement, the 'date' command should be:

date +'%d%m%Y%H%M%S'

The %Y gives a 4-digit year.

Statements like "which is not working" tell us nothing. What went wrong?

Maybe your script should be something like:

#!/bin/sh
DDMMYYYYHHMMSS=`date +'%d%m%Y%H%M%S'` # Evaluate the date once only
cd /vol/best/srcfiles
for filename in "Payor" "customer" "vendor" Employee"
do
       if [ -f "${filename} ]
       then
              mv "${filename}" "${filename}.${DDMMYYYYHHMMSS}"
       fi
done

Btw. The date format YYYYMMDD etc. is much better than DDMMYYYY etc. in filenames because the files will come out in chronogical order in a default "ls" directory list.