0

Good Day

I have currently developed a piece of code that copies files from one location to another. I am currently trying to specify a specific static IP address instead of using a dynamic drive letter that changes from PC to PC.

Currently my code is as follows:

import glob
import os
import shutil
import easygui


def copy(src):
  destination = easygui.diropenbox()
  list_of_files = glob.glob(src)  # * means all if need specific format then *.csv
  latest_file = max(list_of_files, key=os.path.getctime)
  shutil.copy(latest_file, destination)


copy('C:\Users\micha\Desktop\Test_Copy1\*')

Instead of using copy('C:\Users\micha\Desktop\Test_Copy1\*') I was thinking of using something like this: \\ip-address\Users\micha\Desktop\Test_Copy1\*. I have tried using this link UNC however this would mean I would have to get around a login page in the code which I have no clue how to do.

If anyone can help it would be much appreciated.

  • 1
    I am unfortunately a lot of the software that I work with is only compatible with python 2.7. I know its outdated – user5438246 Feb 25 '20 at 09:17
  • @finefoot I tried that but unfortunately if I use a UNC I will have to go through a login page – user5438246 Feb 25 '20 at 09:20
  • Yes when I enter it in on my pc it brings up a login window (which I do know the logins for). However I don't know how to enter the login details using the code hence why I am looking for a different approach. – user5438246 Feb 25 '20 at 09:37
  • yup ticking the checkbox appeared to work – user5438246 Feb 25 '20 at 09:59

0 Answers0