Trying to figure out if possible to using os.listdir on a remote PC.
I want to have user input for a computer name and then take that and use os.listdir to list a certain directory on that PC.
import os
def listdirtory():
computername = input("What is the computer name? ")
completepath = "\\" + computername + "\C$\\users"
os.listdir(completepath)
listdirtory()
Where I am having trouble is I need to take out the second \ after
computername and one \ after users since its reading the path with double \
like this:
FileNotFoundError: [WinError 3] The system cannot find the path specified: '\\\testmachine\\\C$\\\users'
where it would need to be \\\testmachine\C$\users\