Copy files to a destination folder only if the files already exist. but the source files have a different file extension.
i.e I have a backup of some files with ".desktop.in" extension and I want to copy to destination where the files extensions are ".desktop" and only the files that already exist in the destination.
source folder contain:
- a.desktop.in
- b.desktop.in
- c.desktop.in
destination folder contain:
- a.desktop
- b.desktop
Want only to overwrite a.desktop and b.desktop files
Tried this:
for file in /destination/*.desktop;do cp /src/"${file##*/}".in "$file";done
But that doesn't look optimized for that task.
Do you know a better way to do that?