My question is similar to this one but the answers don't address how I would like to solve it in my case:
Background: I have two computers generating experimental results that are filed in directories based on timestamps. E.g.:
190525184212 190525184433 190525185428 190525194813 ...
I am moving the results to one host computer using rsync
(with --remove-source-files
) but since it is possible for two experiments to start during the same second it is possible that this will overwrite results already on the host computer.
What I would like is it append to the directory names when they are identical. Something like this:
190525184212 190525184433 190525184433_1 190525185428 190525194813 ...
(The alternative would be for each machine to add its own unique id to the directory names to avoid conflicts but that means hashing the hostname or something and I am not expecting many conflicts so the solution above would be more appealing to me)
I'm guessing I have to write some kind of bash script (like this one but it was down-voted)? But was hoping for a ready-made solution.
thanks.
Footnote: The sub-directories are not all in one main directory as implied above. There are more than one sub-directory so solutions have to be recursive.
how do I merge identically named files?
– jsotola May 26 '19 at 20:31cp
works here, since it has to be recursive. – Sparhawk May 27 '19 at 01:45find
, compare file names and rename any files with the same names but differentMD5
orSHA256
hashes? – bu5hman May 29 '19 at 17:56