'Performs a generic operation (move or copy) on a file. Can rename the file as well as change its location,
and optionally move associated files too.
:param file_path: The full path of the media file to act on
:param new_path: Destination path where we want to move/copy the file to
:param new_base_name: The base filename (no extension) to use during the copy. Use None to keep the same name.
:param associated_files: Boolean, whether we should copy similarly-named files too
:param action: function that takes an old path and new path and does an operation with them (move/copy)
:param subtitles: Boolean, whether we should process subtitles too'

def _combined_file_operation(self, file_path, new_path, new_base_name, associated_files=False, action=None, subtitles=False):

    if (not action):
        self._log(u'Must    provide    an    action    for    the    combined    file    operation', logger.ERROR)
        return
    file_list = [file_path]
    subfolders = (ek(os.path.normpath, ek(os.path.dirname, file_path)) != ek(os.path.normpath, sickbeard.TV_DOWNLOAD_DIR))
    if associated_files:
        file_list = (file_list + self.list_associated_files(file_path, subfolders=subfolders))
    elif subtitles:
        file_list = (file_list + self.list_associated_files(file_path, subtitles_only=True, subfolders=subfolders))
    if (not file_list):
        self._log(((u'There    were    no    files    associated    with    ' + file_path) + u',    not    moving    anything'), logger.DEBUG)
        return
    for cur_file_path in file_list:
        (cur_file_name, cur_extension) = cur_file_path.rpartition(u'.')[0:3:2]
        if ((cur_extension in SUBTITLE_EXTENSIONS) and (u'.' in cur_file_name)):
            cur_lang = cur_file_name.rpartition(u'.')[(-1)].lower()
            if (cur_lang == u'pt-br'):
                cur_lang = u'pt-BR'
            cur_lang_name = sickbeard.subtitles.from_code(cur_lang).name
            if ((new_base_name and (cur_lang == u'pt-BR')) or (cur_lang_name != u'Undetermined')):
                cur_extension = u'.'.join((cur_lang, cur_extension))
        if ((cur_extension == u'nfo') and (sickbeard.NFO_RENAME is True)):
            cur_extension = u'nfo-orig'
        if new_base_name:
            new_file_name = u'.'.join((new_base_name, cur_extension))
        else:
            new_file_name = ek(os.path.basename, replace_extension(cur_file_path, cur_extension))
        if (sickbeard.SUBTITLES_DIR and cur_extension.endswith(tuple(SUBTITLE_EXTENSIONS))):
            subs_new_path = ek(os.path.join, new_path, sickbeard.SUBTITLES_DIR)
            dir_exists = helpers.makeDir(subs_new_path)
            if (not dir_exists):
                logger.log((u'Unable    to    create    subtitles    folder    ' + subs_new_path), logger.ERROR)
            else:
                helpers.chmodAsParent(subs_new_path)
            new_file_path = ek(os.path.join, subs_new_path, new_file_name)
        else:
            new_file_path = ek(os.path.join, new_path, new_file_name)
        action(cur_file_path, new_file_path)
