Move files in folder if bigger / smaller

I'm using Handbrake to convert a whole bunch of video files on my network drives from x264 (AVC) to x265 (HEVC) to free up space. Each video file is in a sub-folder, and there may be several video files in each sub-folder. That folder structure is recreated on my local drive as the batch proceeds.

Whilst this usually results in a smaller video file (which I move back to the network drive and replace the original file), occasionally it does not.

So what I'm looking for DOpus to do is to move subfolders containing these files, replacing the original files, but only if the size is smaller than the original. Otherwise I want it to be left alone and I'll just delete the local (larger) encode.

I can do this with COPY easily enough through the UPDATEALL modifier, but move / rename does not seem to have an equivalent.

Is this even possible? Thanks in advance for any help or insight you can provide.

I can't think of an easy way to do it without scripting.

Is it something that could be handled during the conversion process? E.g. Make the conversion delete the new file if it isn't smaller than the old one. Then the problem goes away entirely.

I don't think so. Handbrake doesn't have the option to run a command when an encode completes - just display a notification or send the file somewhere else. If it did, I could maybe have knocked up a utility to do it in C#.

Guess I'll have to learn scripting then! Thanks.

Adding keep-larger/smaller options to the copy/move commands is definitely on our to-do list, but I can't say when we'll get to it.


You could use the dupe finder to build a list of pairs with the same file name, sort by file size, delete the larger file per pair, and move the remaining files to the network.


Interesting idea. I don't think I've ever used the dupe finder before. I will investigate, thank you for the suggestion. :slightly_smiling_face: