Failing to copy file from a network to a local drive - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Failing to copy file from a network to a local drive (/thread-32067.html) |
Failing to copy file from a network to a local drive - tester_V - Jan-19-2021 Hi, I'm trying to copy files from a network folder. For some reason my code produces an error: import os import shutil fname = 'somelog_file.txt' p04 = 'D:\\JFLogs\\p04\\' ## local folder ## h04 = '\\\\FF04OBS0004\\c$\\dir\\subdir\\' fto_download = h04+fname print (fto_download) shutil.copy(fto_download, p04)Any help appreciated! Thank you! RE: Failing to copy file from a network to a local drive - Oshadha - Jan-19-2021 This
RE: Failing to copy file from a network to a local drive - tester_V - Jan-19-2021 Yes! "No such file or directory...." I can map the directory to my Server and I see the files and access etc... I do not understand what I'm doing wrong What is it? Thak you@ RE: Failing to copy file from a network to a local drive - tester_V - Jan-20-2021 Any ideas why I'm having this error? Thank you. RE: Failing to copy file from a network to a local drive - tester_V - Jan-20-2021 Just wanted to share, Adding 'try' fixed the problem import os import shutil fname = 'somelog_file.txt' p04 = 'D:\\JFLogs\\p04\\' ## local folder ## h04 = '\\\\FF04OBS0004\\c$\\dir\\subdir\\' fto_download = h04+fname print (fto_download) try: shutil.copy(fto_download, p04) except Exception as e: print (e)Thank you! |