Copy files from folder and rename them

hello, I need to build a shell script that receives the folder to copy by parameter and copy all files except thumb.db to another folder and rename them like, file.jpg renamed to file_bb1.jpg.

can someone help me

Thanks

something like?

for file in $1/*
do
fname=${file##*/}
if [ "$fname" != "thumb.db" ]; then
 newfname=${fname%.*}_bb1.${fname##*.}
 mkdir -p $2
 cp $file $2/$newfname
fi
done
./script /a/b/sourcedir /c/d/destdir

josenunes@hellsing:~/Desktop$ ./cf.sh teste/ teste2/
cp: omitting directory `teste/010'
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `copy)_bb1.jpg' is not a directory
cp: target `(copy)_bb1.jpg' is not a directory
cp: target `folder' is not a directory
josenunes@hellsing:~/Desktop$

can you help me please

thanks

---------- Post updated at 10:12 AM ---------- Previous update was at 10:06 AM ----------

Forget It was the spaces in the file name

thanks for the script

there is an command called rename or sometimes rename.ul in ubuntu.
if its not available, try installing.
say u have files file1.jpg file2.jpg file3.jpg thumbs.db in a folder, you can rename using the command

rename file file_bb1 *.jpg

If you can show the preview of ls command in the dir and what you exactly expect, can help better.

did you mean to say your problem resolved?