def collect_metadata_files(cwd, new_files, existing_files):
    """
    Collect all files from a given path. Separate by file type, and return one list for each type
    If 'files' contains specific
    :param str cwd: Directory w/ target files
    :param list new_files: Specific new files to load
    :param dict existing_files: Files currently loaded, separated by type
    :return list: All files separated by type
    """
    obj = {}
    try:
        os.chdir(cwd)

        # Special case: User uses gui to mult-select 2+ files. You'll be given a list of file paths.
        if new_files:
            for full_path in new_files:
                # Create the file metadata for one file, and append it to the existing files.
                obj = collect_metadata_file(full_path)

        # directory: get all files in the directory and sort by type
        else:
            for file_type in [".lpd", ".xls", ".txt"]:
                # get all files in cwd of this file extension
                files_found = list_files(file_type)
                # if looking for excel files, also look for the alternate extension.
                if file_type == ".xls":
                    files_found += list_files(".xlsx")
                # for each file found, build it's metadata and append it to files_by_type
                for file in files_found:
                    fn = os.path.splitext(file)[0]
                    existing_files[file_type].append({"full_path": os.path.join(cwd, file), "filename_ext": file, "filename_no_ext": fn, "dir": cwd})
    except Exception:
        logger_directory.info("directory: collect_files: there's a problem")

    return obj