0

I try to copy txt file from WinPC1 to WinPC2

In my WinPC1 i created local txt file in:

C:\temp\1.txt

I want to copy that txt file to windows network drive to folder:

OUT\temp

WinPC2 on WinPC1 seen:

  1. by net use like nam1\\box1\\IKQ
  2. by explorer like Z:\

so full paths are:

  1. full path witn net use will be \\\\nam1\\box1\\IKQ\\OUT\\temp
  2. or in explorer will be Z:\OUT\tmp

First of all I tried to use os:

  1. copy C:\temp\1.txt Z:\OUT\tmp - check it in cmd, it was sucsessfull

  2. os.system(r"copy C:\\temp\\1.txt Z:\\OUT\\tmp") - try by python, it wasn't sucsessfull

Then I read about shutil, and try to use it: it didn't work too, try to copy like that:

  1. shutil.copy(r'C:\temp\1.txt', "Z:\OUT\tmp")
  2. shutil.copy(r'C:\temp\1.txt', "\\\\nam1\\box1\\IKQ\\OUT\\temp")

What i need to do?

Gudsaf
  • 289
  • 3
  • 12
  • 1
    Possible duplicate of [Using Python, how can I access a shared folder on windows network?](https://stackoverflow.com/questions/7169845/using-python-how-can-i-access-a-shared-folder-on-windows-network) – Pramit Sawant Jul 26 '18 at 07:49
  • @PramitSawant tried that too – Gudsaf Jul 26 '18 at 08:29
  • i think that main problem in authentication: if i disconnect network drive? to connect it i need a username/passoword it different with my local username/password on WinPC1 - maybe main problem in that me need to use not local but another user/pass in my py script? – Gudsaf Jul 26 '18 at 10:07

0 Answers0