If I use the following line:
shutil.copyfile(r\"\\\\mynetworkshare\\myfile.txt\",\"C:\\TEMP\\myfile.txt\")
everything works fine. However, what
This looks like an escaping issue - as balpha says, the r
makes the \
character a literal, rather than a control sequence. Have you tried:
source_path = r"\\mynetworkshare"
dest_path = r"C:\TEMP"
filename = r"\my_file.txt"
shutil.copyfile(source_path + filename, dest_path + filename)
(Using an interactive python session, you can see the following:
>>> source_path = r"\\mynetworkshare"
>>> dest_path = r"C:\TEMP"
>>> filename = r"\my_file.txt"
>>> print (source_path + filename)
\\mynetworkshare\my_file.txt
>>> print (dest_path + filename)
C:\TEMP\my_file.txt