RESOURCES HUB
Premium
Preview:
You must be registered for see links
C++:
# ----------------------------------------
# Author: KolenMG
# Discord: kolenmg123
# Discord channel: https://discord.gg/wDKzjDvVkj
# Date: 2025-05-01
# Version: 1.0
# Description:
"""
Kolen's Tool For Files Extraction is a simple GUI-based tool that lets you search for specific files (like .gr2 or .msa)
by name across all subfolders of a selected directory. It copies any matching files into an output folder located next to the script,
preserving their original folder structure.
"""
# ----------------------------------------
import os
import shutil
import tkinter as tk
from tkinter import filedialog, messagebox
def copy_files(input_folder, output_folder, target_files):
copied_any = False
for root, _, files in os.walk(input_folder):
for file in files:
if file.lower() in target_files:
source_file_path = os.path.join(root, file)
relative_path = os.path.relpath(root, input_folder)
dest_dir = os.path.join(output_folder, relative_path)
os.makedirs(dest_dir, exist_ok=True)
dest_file_path = os.path.join(dest_dir, file)
shutil.copy2(source_file_path, dest_file_path)
copied_any = True
print(f"Copied: {source_file_path} -> {dest_file_path}")
if copied_any:
status_label.config(text=f"✅ Files copied to: output/", fg="lightgreen")
else:
status_label.config(text="⚠️ No matching files found.", fg="orange")
def select_folder_and_copy():
file_list = entry.get().strip()
if not file_list:
messagebox.showwarning("Input Required", "Please enter filenames to search for.")
return
target_files = {f.strip().lower() for f in file_list.split(",") if f.strip()}
if not target_files:
messagebox.showwarning("Input Error", "Invalid filename list.")
return
input_folder = filedialog.askdirectory(title="Select Input Folder (pack)")
if not input_folder:
return
script_location = os.path.dirname(os.path.abspath(__file__))
output_folder = os.path.join(script_location, "output")
copy_files(input_folder, output_folder, target_files)
# Setup GUI
root = tk.Tk()
root.title("Kolen's Tool For Files Extraction")
root.geometry("500x300")
root.configure(bg="#1e1e1e")
title_label = tk.Label(root, text="Kolen's Tool For Files Extraction", font=("Segoe UI", 16, "bold"), bg="#1e1e1e", fg="#00ffe0")
title_label.pack(pady=(20, 5))
desc_label = tk.Label(root, text="3D Modder's Utility – Search and copy .gr2/.msa files with paths", font=("Segoe UI", 9), bg="#1e1e1e", fg="lightgray")
desc_label.pack(pady=(0, 15))
entry_label = tk.Label(root, text="Filenames to search (comma-separated):", bg="#1e1e1e", fg="white", font=("Segoe UI", 10))
entry_label.pack()
entry = tk.Entry(root, width=50, font=("Segoe UI", 10))
entry.insert(0, "milking.gr2, milking.msa")
entry.pack(pady=5)
copy_button = tk.Button(root, text="🔍 Select Folder and Start Extraction", command=select_folder_and_copy,
bg="#333333", fg="white", font=("Segoe UI", 10), relief="raised", padx=10, pady=5)
copy_button.pack(pady=15)
status_label = tk.Label(root, text="", bg="#1e1e1e", fg="lightgray", font=("Segoe UI", 9))
status_label.pack(pady=(5, 10))
root.mainloop()