'Creates all folders needed to move a file to its new location, renames it, then cleans up any folders
left that are now empty.
:param  cur_path: The absolute path to the file you want to move/rename
:param new_path: The absolute path to the destination for the file WITHOUT THE EXTENSION
:param old_path_length: The length of media file path (old name) WITHOUT THE EXTENSION'

def rename_ep_file(self, cur_path, new_path, old_path_length=0):

    if ((old_path_length == 0) or (old_path_length > len(cur_path))):
        (cur_file_name, cur_file_ext) = os.path.splitext(cur_path)
    else:
        cur_file_ext = cur_path[old_path_length:]
        cur_file_name = cur_path[:old_path_length]
    if (cur_file_ext[1:] in subtitle_extensions):
        sublang = os.path.splitext(cur_file_name)[1][1:]
        if (sublang in subtitle_code_filter()):
            cur_file_ext = ((u'.' + sublang) + cur_file_ext)
    new_path += cur_file_ext
    make_dirs(os.path.dirname(new_path))
    try:
        sickrage.srCore.srLogger.info((u'Renaming    file    from    %s    to    %s' % (cur_path, new_path)))
        moveFile(cur_path, new_path)
    except (OSError, IOError) as e:
        sickrage.srCore.srLogger.error((u'Failed    renaming    %s    to    %s    :    %r' % (cur_path, new_path, e)))
        return False
    delete_empty_folders(os.path.dirname(cur_path))
    return True
