import os
import shutil
# Базовый путь
base_path = r'C:\Users\A3018\645118543500'
# Предположим, что у вас есть переменная с дополнительной частью пути
variable_result = "some_folder"
# Соединяем базовый путь с результатом переменной
full_source_path = os.path.join(base_path, variable_result, "1.txt")
# Путь назначения
destination_path = r'D:\dir2'
# Проверяем, существует ли каталог назначения
if not os.path.exists(destination_path):
os.makedirs(destination_path)
# Копируем файл
shutil.copy2(full_source_path, destination_path)
print(f"Файл успешно скопирован из {full_source_path} в {destination_path}")