Ok, this is basically the same as klapaucius' answer.
(And it won't repair any damage done if cp
has overwritten some existing files.)
Assuming you are in the source directory (in dir
). This command:
find . -type f -exec echo '{}' ';'
will list all the files (recursively) present in your dir
directory (quite like -print
). The -type f
option is there to prevent the listing of sub-directories.
So, if you use:
find dir -type f -exec echo '../../../{}' ';'
This should list corresponding files (copies) in the target directory.
Now if the list is correct, you will be able to remove the copies using:
find dir -type f -exec rm -- '../../../{}' ';'
As for pruning remaining empty directories that come from the cp
… hum…