Bash script to clean movies name


The issue when you download movies online, is that most of the time the file name is going to be complete trash , filled with useless info like the team that made the rip or the website from where the movie was downloaded.
This is very annoying when you sort by name and the website made the idiotic decision to put their name in front of the actual film name.

for example here a typical movie name
[ Torrent9.info ] Dont.Think.Twice.2016.FRENCH.WEBRip.XviD-NEWCiNE.avi
the actual useful data that i wish to keep is Dont.Think.Twice.2016.avi

for this purpose i’ve developped a small bash script that will list all the files in a chosen directory then , if necessary , will rename the file.

this is not a very efficient script
but it’s fulfill it’s purpose and very rarely encounter a filename that he is unable to clean.

3 thoughts on “Bash script to clean movies name

  1. What about if I have a group of folders with files inside of them.

    For example, using your file path of /media/freebox/ there are the following:

    /media/freebox/Titanic (1997) [WEBRip] [1080p] [YTS.AM]/
    /media/freebox/Titanic (1997) [WEBRip] [1080p] [YTS.AM]/Titanic.1997.1080p.WEBRip.x264-[YTS.AM].mp4
    /media/freebox/Love, Wedding, Marriage (2011) [BluRay] [720p] [YTS.AM]
    /media/freebox/Love, Wedding, Marriage (2011) [BluRay] [720p] [YTS.AM]/Love,.Wedding,.Marriage.2011.720p.BluRay.x264-[YTS.AM].mp4

    How would I rename the files contained within the subfolders, and the subfolders themselves?

  2. Hello, Thanks you for this batch file.

    If I want replace the dot by a space in the name but not “.avi” ,What is the command line ?

  3. It is nice for a start.
    I’m working on similar one but my approach is a bit different and it goes as follow:
    Read year from the filename.extension, consider only the last group of 4digits,
    Read .extension,
    Delete any brackets and their content,
    Replace any space or dot with +,
    Search in the internet for IMDb+year+whatever+left+from+filename,
    Get movie IMDb index number,
    Download IMDb movie website,
    Extract proper movie tittle and release year,
    MV old to new.

    Change filename to ‘tittle (release year)’.extension

Leave a Comment

Your email address will not be published. Required fields are marked *