File size: 710 Bytes
920b3b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
import shutil
txt_dir = './dev_output'  
wav_json_dir = './dev_data'  
output_dir = './dev_data_rest' 

txt_files = [os.path.splitext(file)[0] for file in os.listdir(txt_dir) if file.endswith('.txt')]
for file in os.listdir(wav_json_dir):
    if file.endswith('.wav') or file.endswith('.json'):
        file_name_without_extension = os.path.splitext(file)[0]
        if file_name_without_extension not in txt_files:
            source_file_path = os.path.join(wav_json_dir, file)
            destination_file_path = os.path.join(output_dir, file)
            shutil.copy2(source_file_path, destination_file_path)
            print(f'Copied: {file}')
print('Operation completed.')