I need to find all files (e.g. with extension ABC) and copy it into one directory but creating unique filenames not to overwrite any files with the potential same name.
Something like this:
find /tmp -name \*.ABC | xargs cp '{}' somedir/$(echo {} | md5sum | cut -c1-6){} \;
Creating files like:
b786af1_original_name.ABC
a7af335_original_name_2.ABC
...
The command above obviously cannot work because $( … ) statement is getting evaluated once. I need to evaluate it for every file name.
How to do that?
Why not read?