0

I'm trying to do a very simple thing (I think) which is copying a file from a server to my local computer. Both are in the same local network or at least i have permissions to access (since it answers to a ping). Here's the code I'm using:

import shutil
shutil.copy(r'serverIP\C:\Route\File.xlsx',r'D:\OneDrive\Documentos\File.xlsx')

And im getting the following error even though the file does exist:

FileNotFoundError: [Errno 2] No such file or directory: '\\\\serverIP\\C:\\Route\\File.xlsx'

Am I missing something on my command? Am I writing correctly the serverIP path?

If not by shutil, how would you address this need? I've got all of the information about the server but thing is I really have no experience with networks.

  • shutil.copy() only copy files in your local compute – Gonzalo Odiard Oct 08 '21 at 22:40
  • thanks. What should I use then to copy a file from a server to my local computer? I've read a lot of questions and forums and the easiest is using shutil. But how would you address this particular need? – Gustavo Zárate Oct 08 '21 at 22:44
  • if you have `scp` in yoyur server, you can try this https://stackoverflow.com/questions/250283/how-to-scp-in-python but looks like you are on a windows environment so maybe something like this is useful https://stackoverflow.com/questions/41177567/how-do-i-copy-files-from-windows-system-to-any-other-remote-server-from-python-s – Gonzalo Odiard Oct 08 '21 at 22:47

0 Answers0