I have made this code to copy a folder to another disk, and it works, but I think there is a better way.
If don't use the replace()
, it says the folder exists and it is correct. The 'T': is real. Can someone point me to the right path?
The folder_path
is the path for the torrent folder. it is a normal path, like: 'D:/FILES/MYFOLDER'
. The file_path
is a variable as to make a torrent, if a folder=folder_path, if a file=file_path, but its not important for the question.
folder_path = 'D:/FILES/MYFOLDER'
file_path = ''
src = folder_path
folder_path_copy = folder_path.replace('D:/FILES/', '')
destination = 'T:' + folder_path_copy
logging.info('Copying files')
if file_path == '':
shutil.copytree(src, destination)
logging.info('Folder copied')
else:
pass