File size: 736 Bytes
e06edfe
 
 
 
 
 
 
 
 
 
 
 
 
 
e8d5ad1
e06edfe
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os

def log_zip_files(root_folder, output_file):
    with open(output_file, "w") as f:
        for dirpath, dirnames, filenames in os.walk(root_folder):
            for file in filenames:
                if file.lower().endswith(".zip"):
                    # Remove the .zip extension and write only the file name
                    file_name_without_ext, _ = os.path.splitext(file)
                    f.write(file_name_without_ext + "\n")

if __name__ == "__main__":
    # Set the directory you want to start searching from; here it's the current directory
    root_folder = "."
    output_file = "log.txt"
    log_zip_files(root_folder, output_file)
    print(f"ZIP file names without extension logged in '{output_file}'.")