I'm working with graphic design. I've downloaded many files (EPS
files, PSD
files, etc) from various websites.
Because it come from various websites, after downloaded from more than 10 different websites, I got many same files with same size, and same everything but different file name (2 to 4 copies for same file). To remove the duplication by manually open one by one is very time consuming
I hope there is a way to rename all downloaded files to be unique name for different files (I don't mind if the new name is not descriptive).
For example, 2 same file: file nice-sun.eps
downloaded from site 1, while 678.eps
downloaded from site 2. It will become same file name after renamed.
Best Answer
This command will rename all files to the md5sum of their content. That means files with the same content will get the same name.
You can replace
md5sum
withsha1sum
in the command.For this demonstration I added
-v
tomv
so we can see what is being renamed.You can also safely run this command in a directory where some files have unified filename while other have not.
Note that it will still calculate the hash of the files that are already hashed. So if the files are huge you might want to prevent the rehashing.