I have a file system tree and on different locations within it are files with the same name. I tried the following command on the command line:
find / -name "HAHA" -exec mv {} /home \;
It only worked for one file, for the others I received an error message for having the same name.
Can I change the command in a way that for each file name a number will be attached to distinguish them?
mv "$0" /home/$(uuidgen)
to give each file a new, unique name. Would such a solution be acceptable?find
but it did not accept it. Creating a script worked but that did not allow the number to be incremented. I am interested in the solution myself now.