copying a icon and pasting to a folder

I want to know how to copy a "folder.jpg" from within a folder or subfolder in some cases, and paste it onto the main folder as a icon. Normally, I open the folder, double click on the "folder.jpg" >select all> copy. Close the picture. then click command I, then command V to paste the picture on the folder. How can I automate this, if possible? Thank you.