I'm trying to write a script that will go to a host and list all of its shares.
So far, in my searching, it seems that I need to include a top level share name.
For example:
os.listdir('\\\\1.2.3.4\\')
doesn't seem to work, but
os.listdir('\\\\1.2.3.4\\share\\')
will work.
As a bit of a work-around, I was thinking of first running "net view" and then taking the output from that to input the share name. The only problem I have is I'm not sure how to handle the net view output.
Share name Type Used as Comment
--------------------------------------------------------------
Data Disk
Data2 Disk
My Docs Disk
Users Disk
The command completed successfully.
I thought of using REGEX to look for the lines that contain the work "Disk", but I don't know how to separate the string at that point to get only the share name.
Any tips would be appreciated, or if you know of a better way I can accomplish this, I'm open to suggestions.
Thanks.