Link to home
Start Free TrialLog in
Avatar of therealims
therealimsFlag for United States of America

asked on

Searching File Names and Eliminating Duplicates in Linux

I am looking for a way to search through a folder and have the system remove "duplicate" copies of files.  For example, I may have the following files in my folder:

Movie1_SD_480p.mp4
Movie1_HD_720p.mp4
Movie1_HD_1080p.mp4
Movie1_HD_4k.mp4

I would like the script to keep the "Movie1_HD_4k.mp4" file but remove the rest.  If the 4k file is not present, then I would like it to preserve "Movie1_HD_1080p.mp4" and so on.  How would I write such a script using standard Linux commands?
SOLUTION
Avatar of huacat
huacat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of skullnobrains
skullnobrains

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of therealims

ASKER

Thank you!  This is exactly what I was looking for!