FAQ
I'm trying to discover and walk the shared folders and files of a computer
on my network, let's call it ComputerA. If I know ComputerA is sharing a
folder called Source, I can use

files, err := ioutil.ReadDir("\\\\ComputerA\\Source")

to get a list of all the files in Source. However, I can't do this to find
Source (or any other shared folders)

files, err := ioutil.ReadDir("\\\\ComputerA")

It seems that ioutil can't list the root shared folders using a UNC path
like this. I've looked over the stock packages rather quickly and nothing
else jumps out at me as a way to do this.

It's not a permissions issue as far as I can tell. I can open up explorer
and go straight to \\ComputerAand it'll work just fine.

How else can I discover the shared folders for a specific computer on my
network?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Brainman at Feb 12, 2015 at 10:56 pm

    On Friday, 13 February 2015 08:17:53 UTC+11, cor...@gmail.com wrote:

    ... I can't do this to find Source (or any other shared folders)

    files, err := ioutil.ReadDir("\\\\ComputerA")
    It seems that ioutil can't list the root shared folders using a UNC path
    like this.

    ioutil.ReadDir uses FindFirstFile Windows API to list files in specified
    directory. As you've discover that API does not work if you want to list
    server shares. You just have to use different (appropriate) Windows API.
    ... I can open up explorer and go straight to \\ComputerAand it'll work
    just fine.

    "explorer" obviously uses appropriate API.
    ... How else can I discover the shared folders for a specific computer on
    my network?

    I don't know. I doubt anyone here knows - this is Go language forum. You
    better ask this on stackoverflow.com or similar.

    Alex

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 12, '15 at 9:28p
activeFeb 12, '15 at 10:56p
posts2
users2
websitegolang.org

2 users in discussion

Coreyog: 1 post Brainman: 1 post

People

Translate

site design / logo © 2022 Grokbase