<commit_before># Write a program that walks through a folder tree and searches for files with a
# certain file extension (such as .pdf or .jpg). Copy these files from whatever
# location they are in to a new folder.
<commit_msg>Update P01_selectiveCopy: working solution<commit_after># Write a program that walks through a folder tree and searches for files with a
# certain file extension (such as .pdf or .jpg). Copy these files from whatever
# location they are in to a new folder.

import os, shutil

FOLDER = "../"
EXTENSION = ".zip"
NEW_FOLDER = "new_folder"

os.chdir(FOLDER)
os.mkdir(NEW_FOLDER)
# Walk through a folder tree
for foldername, subfolders, filenames in os.walk("./"):
    print("Looking in folder: %s..." % foldername)
    # Find files with a specific extension
    for filename in filenames:
        if filename.endswith(EXTENSION):
            # Copy files to a new folder
            print("Copying file: %s..." % filename)
            shutil.copy(filename, NEW_FOLDER)
print("Done.")

{'fraction_non_alphanumeric': 0.09117938553022795, 'fraction_numerical': 0.0019821605550049554, 'mean_word_length': 3.449339207048458, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2657914', 'n_tokens_mistral': 297, 'n_tokens_neox': 290, 'n_words': 128}