Rename files by size

Advanced Renamer forum
#1 : 02/02-19 16:21
Posts: 3
I need to rename multiple files that have common size. I hope to explain my problem with an example.

I have two different paths, here I call them "A" and "B":

Path A contains:
|____file1.mp3 (size 510 kb)
|____file2.mp3 (size 300 kb)
|____file3.mp3 (size 430 kb)

Path B contains:
|___abc.mp3 (size 510 kb)
|___abcd.mp3 (size 300 kb)
|___abcde.mp3 (size 430 kb)

Please note that "(size *** kb)" isn't in the filename, I added it here for example.
File order isn't the same for Path A and B.

What I need to do is rename "abc.mp3" [Path B] to "file1.mp3" [Path A] since they have same size; next, "abcd.mp3" [Path B] to "file2.mp3" [Path A] etc.
So I need to rename the files in Path B with the same name of the files in Path A that have the same size.

Is it possible with Advanced Renamer?
Thank you!

02/02-19 16:21 - edited 02/02-19 16:25
#2 : 02/02-19 22:54
David Lee
David Lee
Posts: 106
Reply to #1:
You can accomplish this via the List method.

First you need to add a "Size" column to the list - click the columns button on the toolbar just above the column headers.

Then populate the list with your Path A files - drag Path A Root Folder into the list and "Add the files in the folders" and "Include subfolders".

Click on the Size column header to order the files in increasing order of size.

Add the List method and click on "Populate list"

Clear the list, drag in your Path B files and order by size as you did for Path A.

Run the batch and job done.

02/02-19 22:54
#3 : 03/02-19 14:59
Posts: 3
Reply to #2:
Thanks for your answer!
There are two problems: the size column shows dimensions in kb, mb etc. But what will happen if two files have similar size in mb and different in bytes? For example a 2863 byte file is 2.79 kb, and a 2860 byte is the same, 2.79 kb. Will the order be respected? I tried with test files, and the software seems to take care of the correct size even if the same size is shown in the column, but I don't know if it uses another way to order files that have a similar size (like order by name, creation date...).
Second: Path A contains also files that are not in path B, and path B contains also files that there aren't in path A. I'm trying to manage this problem with softwares that finds duplicates between the two paths by size, creating a txt file listing only common files, and loading it into Advanced Renamer. Unfortunately they also check the contents of the file, not just the size, saying that files aren't duplicates.

03/02-19 14:59 - edited 03/02-19 15:01
#4 : 03/02-19 15:53
David Lee
David Lee
Posts: 106
Reply to #3:
I don't think the first issue is a problem - I believe that the size used is in bytes irrespective of how it is displayed.

Regarding the second issue - you didn't mention that! I think it will be a killer for finding a solution purely within ARen. I've searched around previously and it seems that you cannot access the local file system object using this implementation of JavaScript - so the Script method would not help.

However if you have a recent version of Excel, Microsoft Power Query should allow you to load directory listings including filesize. If you do this for both Path A & B then you should be ably to use a Query to identify common files. If you save the size-ordered file list as a text file you will be able to load it into the List method and carry on from there.

It may take you a bit of puzzling to sort out how to use Queries - however I managed it a few months ago (with a bit of help from Google) to identify matching records in parallel worksheets so it isn't too difficult.

Have a look at:

Edit: Just noticed that you also said that BOTH paths contain non-matching files. In which case you would probably need to do all the matching in Excel and create a csv file containing original and new filenames and import it into ARen using "Import" => "Files from CSV..."

03/02-19 15:53 - edited 03/02-19 16:06
#6 : 04/02-19 21:41
Posts: 3
Reply to #4:
Power Query method worked! Here is what I've done, maybe it can be useful for other ARen users:
I loaded in a sheet Path B files, in another sheet Path A files. Columns: A: path; B: size. Then i used this command in Excel: =INDEX(PathA!A:A; COMPARE(PathB!B:B;PathA!B:B;0)): in this way I obtained a column with correct names. Finally I loaded the CSV in ARen.
Since it worked, I'm investigating how to to use the same method to copy Path A file details (creation date and last edit date) to Path B files; and how to move (or copy) Path B files in the same subfolders of Path A files (now they're only in a big folder). Do you think is it possible with ARen?

04/02-19 21:41 - edited 04/02-19 21:43