There is already a related question talking about setting a png image to file or foler as icon ( How can I change a file or folder icon using the Terminal), but what if my image is an icns?
I know pngs may be extracted from an icns, then follow the solution above. But icns has an advantage that it could fit different sizes. So how could I set apple icon image (xxx.icns) to file or folder?