-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCalibGenerator.py
More file actions
30 lines (23 loc) · 967 Bytes
/
Copy pathCalibGenerator.py
File metadata and controls
30 lines (23 loc) · 967 Bytes
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
30
import os
import shutil
# Define the source file and directory paths
source_dir = './'
source_file = 'calib_sample.txt'
calib_dir = '...\calib_AVX'
label_dir = '...\labels_AVX'
# Define the parent directory path
parent_dir = '..'
# Define the destination directory path
destination_dir = os.path.join(parent_dir, calib_dir)
# Create the destination directory if it doesn't exist
if not os.path.exists(destination_dir):
os.makedirs(destination_dir)
# Define the labels directory path
labels_dir = os.path.join(parent_dir, label_dir)
# Iterate over the label files in labels_dir
for label_file in os.listdir(labels_dir):
if label_file.endswith('.txt'):
# Generate the destination file path
destination_file = os.path.join(destination_dir, label_file)
# Copy the source file to the destination directory with the new name
shutil.copyfile(os.path.join(source_dir, source_file), destination_file)