import os import shutil def move_non_npz_files(source_folder, destination_folder): # Ensure the destination folder exists if not os.path.exists(destination_folder): os.makedirs(destination_folder) # Iterate over all files in the source folder for filename in os.listdir(source_folder): # Construct the full file path source_file_path = os.path.join(source_folder, filename) # Check if the current item is a file (not a directory) and not a .npz file if os.path.isfile(source_file_path) and not filename.endswith('.npz'): # Construct the destination file path destination_file_path = os.path.join(destination_folder, filename) # Move the file shutil.move(source_file_path, destination_file_path) print(f'Moved: {filename} to {destination_folder}') # Define your source and destination folders source_folder = '/path/to/source/folder' destination_folder = '/path/to/destination/folder' # Move non-.npz files move_non_npz_files(source_folder, destination_folder)