File size: 1,082 Bytes
4b0a67f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)