Search code examples
pythonnetwork-shares

How to copy file from a network using Python


I want to use Python to copy a zip file (test.zip) from shared network (\svr\shared) to my local computer C:\ drive. Also, my windows account already has access to the network.

One more thing, how can I get the content of a network shared folder? Let's say, I need all the file names located at \svr\shared.


Solution

  • Try this:

    from shutil import copyfile
    src = r'\svr\shared\test.zip'
    dst = r'C:\test.zip'
    copyfile(src, dst)