Rename and move based on SHA-256

Advanced Renamer forum
#1 : 15/02-17 10:27
Posts: 2
I want to rename and move a batch of files based on it's SHA-256 Checksum.
Renaming the files with <Sha256> works perfectly.

But I can't find a solution for moving the files.

I want to get a folder with 16 subfolders (0-F)
In every of that folder I want 16 Subfolders again.
Based on the first Characters of the name it Should be moved in the corresponding folder.

Here an example:

Checksum: f2c5f91398010daab4f304000d4577ff84159e69bd0dd91674727f9622efd0a7


Is there any sort of prefix I can add to <SHA256> to tell AR that I only need the 1st or 2nd... character of the filehash?

15/02-17 10:27
#2 : 15/02-17 19:10
G. Lambany
G. Lambany
Posts: 187
Reply to #1:
method: script

item.newPath = item.path + item.sha256.substr(0,1) + "\\" + item.sha256.substr(1,1) + "\\" ;
return item.sha256;

put AR in move mode (or copy, if that is what you are after)

think that'll do


15/02-17 19:10
#3 : 16/02-17 09:31
Posts: 2
Reply to #2:
Thanks a lot thats exactly what I was looking for.

Just one thing. If I understand it correctly the script has to generate the Checksum 3 times per file.
That seems a bit unefficent to me. Wouldn't it be faster to generate it once and write it in a variable or wouldn't that make a relevant difference?

16/02-17 09:31
#4 : 16/02-17 15:13
G. Lambany
G. Lambany
Posts: 187
Reply to #3:
Yes and no

Your reasoning is correct, so yes, but I think it's already a calculated value stored in a variable in AR, hence don't need to double store it. Think that sha256 and exif tags are part of the "loading" process when you add files to AR.

I'm only guessing, since I don't have the source code, but it's an educated guess, so you should be alright.


16/02-17 15:13