'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 subs: Boolean, whether we should process subtitles too'

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

    if (not action):
        self._log(u'Must    provide    an    action    for    the    combined    file    operation', sickrage.srCore.srLogger.ERROR)
        return
    file_list = [file_path]
    if associated_files:
        file_list = (file_list + self.list_associated_files(file_path))
    elif subs:
        file_list = (file_list + self.list_associated_files(file_path, subtitles_only=True))
    if (not file_list):
        self._log(((u'There    were    no    files    associated    with    ' + file_path) + u',    not    moving    anything'), sickrage.srCore.srLogger.DEBUG)
        return
    old_base_name = file_path.rpartition(u'.')[0]
    old_base_name_length = len(old_base_name)
    for cur_file_path in file_list:
        cur_file_name = os.path.basename(cur_file_path)
        cur_extension = cur_file_path[(old_base_name_length + 1):]
        if (os.path.splitext(cur_extension)[1][1:] in subtitle_extensions):
            cur_lang = os.path.splitext(cur_extension)[0]
            if (cur_lang in wanted_languages()):
                cur_extension = (cur_lang + os.path.splitext(cur_extension)[1])
        if ((cur_extension == u'nfo') and (sickrage.srCore.srConfig.NFO_RENAME == True)):
            cur_extension = u'nfo-orig'
        if new_base_name:
            new_file_name = ((new_base_name + u'.') + cur_extension)
        else:
            new_file_name = replaceExtension(cur_file_name, cur_extension)
        if (sickrage.srCore.srConfig.SUBTITLES_DIR and (cur_extension in subtitle_extensions)):
            subs_new_path = os.path.join(new_path, sickrage.srCore.srConfig.SUBTITLES_DIR)
            dir_exists = makeDir(subs_new_path)
            if (not dir_exists):
                sickrage.srCore.srLogger.error((u'Unable    to    create    subtitles    folder    ' + subs_new_path))
            else:
                chmodAsParent(subs_new_path)
            new_file_path = os.path.join(subs_new_path, new_file_name)
        else:
            new_file_path = os.path.join(new_path, new_file_name)
        action(cur_file_path, new_file_path)
