Deleting images with the same filename, keeping file with largest filesize

51 Views Asked by At

I have a massive bank of images (8000 files) however they relate to only 700 products and are basically just different sizes of the same image. The images are named like:

  • avao-sit_3 3.jpg
  • avao-sit_3 2.jpg
  • avao-sit_3 1.jpg
  • avao-sit_3.jpg
  • avao-bod-fast5_5_1 3.jpg
  • avao-bod-fast5_5_1 2.jpg
  • avao-bod-fast5_5_1 1.jpg
  • avao-bod-fast5_5_1.jpg

I would like to know if it's possible to delete all files of the same name (baring in mind the file names are slightly different with 2 3 4 etc at the end) but keep the one with the largest file size.

Is this possible or will I have to manually do this?

1

There are 1 best solutions below

0
On BEST ANSWER

Ended up manually completing this… fun ;)!