Shell Script for Copy Files and and append modified date

Dear All,

I've asked similar question for Windows and Mac, but I need the same thing for linux.

I need a shell script for this :

I have a folder that contain several files, for example Folder A with 3 files : Susan.log, Mitch.log, Bryan.log. OS : Windows XP

I want to copy those 3 files to folder B, but I need when copied the file name will append date time with format : yyyymmdd. With the yyyymmdd is fetched from the modified date of those 3 files.

File in Source Folder         Modified Date               The result of copy in Folder B
=================        ==============         =============================
Susan.log                           23-March-2010            20100323-Susan.log
Mitch.log                             18-Dec-2009                20091218-Mitch.log
Bryan.log                            7-Dec-2008                 20081207-Bryan.log

Please give me the SH file for these results : copy files from folder A to Folder B, with the files name including the modified date of the corresponding files.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cp A/Susan.log  B/`date --date '23-March-2010' +%Y%m%d`-Susan.log
cp A/Mitch.log  B/`date --date '18-Dec-2009' +%Y%m%d`-Mitch.log
cp A/Bryan.log  B/`date --date '7-Dec-2008' +%Y%m%d`-Bryan.log
softblessAuthor Commented:
I need the script to scan all the files in that folder then copied + append the modified date. Could you complete the script?
Append modified date of each file?

cd A; for i in *;do d=`ls -l $i | awk '{print $6, $7, $8}'`; cp $i ../B/`date --date "$d" +%Y%m%d`-$i; done; cd -

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.