A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

November 7, 2010

script: rename files by using cksum

Hello,

I have to do a very simple task but being a newbie, it’s becoming a challenge

Here is what I have to do:
1. I have a bunch of *.html files – most of them are duplicates: file1.html, file6.html and file12.html could be duplicates.
2. I have to eliminates the duplicates by using the cksum and rename the files by using the ‘sum’ value (sum.html)

Something like:
$ cksum file1.html
339238769 1918 file1.html
$ cp file1.html 339238769.html

My script should be able to do this for several folders:

../folder1/*.html
../folder2/*.html
.......................
../folder100/*.html

Thanks for any help.

Click Here!