Need a Script - Move/Replace using FILE SIZE as Criteria

Can anyone help with a script to accomplish the following? Can't be done natively in DOpus so I need a script...but don't have a clue how to do this.

I have a large collection of files (PDF's) and want to consolidate them in to one directory (or folder tree). I can not figure out how to move the files that have the same name but are different sizes (regular PDF vs optimized (smaller) PDF).

I want a one-way move/replace but don't want to click the Skip/Replace dialog box for every duplicate file. I always want the smaller file. For exact dupes, I want to always to replace.

I have gone through the synchronize command/documentation but it doesn't seem to work on file SIZE. I need to do this with a script.

Can anyone help?


What is "large" and would you be able to setup a "Find" for all these pdf files (including the Duplicates)?
I thought, a quick script column, sortable by "has larger Duplicate"or something, might be sufficient to get the job done?

I have two directories: Old PDF's and New PDF's. I could do a find to include both directories by file extension, for example. By larger I mean filesize1>filesize2, not necessary above a certain size. The comparison is between the duplicates only.

Then I would need a script to de-dupe based on file size. As I understand it, the DOpus de-dupe function prefers files by the order that the directories are added to the initial find criteria, so that doesn't accomplish what I want to do, which is to always prefer the smaller (i.e., already optimized) version of the same PDF file.

Does that help make it more clear?

I really appreciate the assistance. This has vexed me for months.


The duplicate finder will select files for deletion based on the sort order, so you could sort by size to make it keep the largest or smallest file in each duplicate group.

Leos suggestion sounds pretty perfect!? o)

It actually is exactly what I had in mind with a dedicated script column. Group/sort the duplicates, select them, move/copy/delete them.