How do I add the md5sum (or equivalent) of each file in a big bunch of files to each filename?
[Edit:] I had
posted this on ubuntuforums as well a few hours ago, and now that seems an uncool thing to have done, since I might make goodhearted people do unnecessary work for me.
Also, using exif-data seems more sensible. An answer I got about that was as follows:
Quote:
|
exiv2 rename -r "%m-%d-%y@%H:%M:%S " *.*
|
That would probably need to be modified to include the filtering with the find command... Or just putting DSCN* instead of *.* (allthough *.* would not rename files that have no exif-data, I presume...)[/Edit]
Actual use case:
Quote:
I have lots of photos on 2 computers, most of the files being on both, but under different directory structures and some filenames possibly being duplicate for different photos even one particular computer but in different subfolders.
I want to get organized and start syncing, but first I want to make sure all photos have unique filenames and can be in one big fat directory.
|
By appending some unique hash to the filename I could do something like the following command to copy all photos to one dir (all my photos start with "DSCN"):
Code:
find . -type f -name \DSCN* -exec cp {} /home/username/bigfatphotodir/ \;
I don't know whether that would overwrite files, which it should do once I've got the hashes appended, since then all name-dupes will also be actual dupes.
I guess the md5sum calculating and hash-appending should be put into that command somehow.