I have a folder with a lot of images for a multilingual site, the images are stored in the next format filename.lang_code.jpg, on the deploy script i want to pick the correct one for the site I'm deploying and copy it to filename.jpg so I can share the same css between the sites.
So, what I need is something like the command rename, but performing a copy, not a move, because I need to keep all files.
I'm doing it with the next code, but I find it overcomplicated and awful.
find -name "*.es.*" -print0 | xargs --null -I {} sh -c "echo {} | sed 's/.es//' | xargs -I }{ sh -c 'cp {} }{'"