How can I list the directories on a network other than using os.listdir()
This prompts me error
import os
path = r"\\123.12.12.123"
print(os.listdir(path))
FileNotFoundError: [WinError 67] The network name cannot be found: '\\\\123.12.12.123'
This is fine but NOT what I want
import os
path = r"\\123.12.12.123\abc"
print(os.listdir(path))
Tried all these and got the same error code.
path = "\\\\123.12.12.123"
path = "\\\\123.12.12.123\\"
path = "//123.12.12.123"
UPDATE:
it's a server address but not a valid UNC path. \123.12.12.123\abc is the actual root of a shared drive.
os.listdir()
will not do the job, we will need to use some other alternative to list the share drives as mentioned in answer section.