def _get_target_list(self):
        """ fetches a list of files in the self.sourcedir location. """

        copy_files = None
        try:
            dir_list = os.listdir(self.sourcedir)
            dir_list.sort()

            # strip unwanted files
            target_list = [os.path.join(self.sourcedir, x) for x in dir_list
                             if x.lower().endswith(TaggerUtils.FILE_TYPE)]
            if self.copy_other_files:
                copy_files = [os.path.join(self.sourcedir, x) for x in 
                    dir_list if not x.lower().endswith(TaggerUtils.FILE_TYPE)]

            if not target_list:
                logger.debug("target_list empty, try to retrieve subfolders")
                for y in dir_list:
                    tmp_list = []
                    logger.debug("subfolder: %s" % y)
                    sub_dir = os.path.join(self.sourcedir, y)
                    if os.path.isdir(sub_dir):
                        tmp_list.extend(os.listdir(sub_dir))
                        tmp_list.sort()
                        tmp_list = [os.path.join(sub_dir, y) for y in tmp_list]

			# strip unwanted files
			target_list.extend([z for z in tmp_list if 
				    z.lower().endswith(TaggerUtils.FILE_TYPE)])
			if self.copy_other_files:
			    copy_files = [z for z in tmp_list if not 
				    z.lower().endswith(TaggerUtils.FILE_TYPE)]

        except __HOLE__, e:
            if e.errno == errno.EEXIST:
                logger.error("No such directory '%s'", self.sourcedir)
                raise IOError("No such directory '%s'", self.sourcedir)
            else:
                raise IOError("General IO system error '%s'" % errno[e])

        return {"target_list": target_list, "copy_files": copy_files}
dataset/ETHPy150Open jesseward/discogstagger/discogstagger/taggerutils.py/TaggerUtils._get_target_list