I have a directory full of pdf files of journal articles, most of which are named by their bibtex key. Some time ago I made a backup on an external hard drive, but I haven't kept it up to date and there are tons of duplicates with different names. I want to get the two directories back into sync and delete the extra files.
Using fdupes I have identified a bunch of these, and now I have a nice paired list of them. However, most of the duplicates on the external drive have meaningless names. I'd like to rename them to be the same as the duplicate in the first directory, rather than deleting them and copying them over again, because there are so many of them. So I don't want to just use rsync.
For example, if the fdupes output is:
/home/articles/bibtex.pdf
/external/articles/morearticles44.pdf
Is there a faster way than writing
mv /external/articles/morearticles44.pdf /external/articles/bibtex.pdf
for each pair of duplicates?
mv
a file onto itself,mv
will just print a message saying that they are the same file and then not do anything. There is no need to make any special provision. – Graeme Apr 09 '14 at 21:13