#!/usr/bin/env bash # # Renames subtitle files (srt) to match the media file name and # adds English (eng) in the suffix. This script was made to fix # RARBG TV shows downloaded from Bittorrent. # Enter the root dir containing the media files and Subs dir: rarbg_dir="/mnt/smb/media/temp/ffmpeg-vcodec/Upload.S01.1080p.WEBRip.x265-RARBG[eztv.re]" # Enter the subtitle file name witout extension you want to fix: subtitle_name=13_Italian cd "$rarbg_dir" for f in *.mp4; do rename -v "s/$subtitle_name/${f/.mp4/.ita}/" ./Subs/"${f/.mp4/}"/$subtitle_name.srt && mv -vn ./Subs/"${f/.mp4/}"/"${f/.mp4/.ita.srt}" . ; done