Accessing shared windows smb:// folder

Discussion in 'Ruby' started by sa 125, Feb 17, 2009.

  1. sa 125

    sa 125 Guest

    I'm running ubuntu linux on an office network with mostly windows
    machines. I have a shared network folder that I can access with samba
    as:

    smb://hostname/shared

    I'm trying to write a script that will read the contents of that shared
    folder, but can't access it using the above address. I tried to print
    the content:

    Dir.entries('smb://hostname/shared').each { |e| puts e }

    But obviously got a no such directory error. I know this isn't the way
    to go, but I can't figure out how to read that location.

    Any tips will be great - thanks!
    --
    Posted via http://www.ruby-forum.com/.
     
    sa 125, Feb 17, 2009
    #1
    1. Advertising

  2. sa 125 wrote:
    >
    > Dir.entries('smb://hostname/shared').each { |e| puts e }
    >
    > But obviously got a no such directory error. I know this isn't the way
    > to go, but I can't figure out how to read that location.


    I guess the usual way is to mount the smb filesystem and then use it as
    any other directory. Google for +linux +mount +smb.
    --
    Posted via http://www.ruby-forum.com/.
     
    The Higgs bozo, Feb 17, 2009
    #2
    1. Advertising

  3. sa 125

    List.rb Guest

    On Feb 17, 2009, at 2:26 AM, sa 125 <> wrote:

    > I'm running ubuntu linux on an office network with mostly windows
    > machines. I have a shared network folder that I can access with samba
    > as:
    >
    > smb://hostname/shared
    >
    > I'm trying to write a script that will read the contents of that
    > shared
    > folder, but can't access it using the above address. I tried to print
    > the content:
    >
    > Dir.entries('smb://hostname/shared').each { |e| puts e }
    >
    > But obviously got a no such directory error. I know this isn't the way
    > to go, but I can't figure out how to read that location.
    >
    > Any tips will be great - thanks!
    > --
    > Posted via http://www.ruby-forum.com/.
    >



    From the windows clients, Dir["\\\\server\\share\\*"]

    From the samb server, just use the actual directory that's mounted.

    For other nix hosts, I would setup nfs mount points
     
    List.rb, Feb 17, 2009
    #3
  4. [Note: parts of this message were removed to make it a legal post.]

    there is a (still quite experimental but working) ruby samba client you
    could use:
    http://sambala.rubyforge.org/

    it won't answer the .each method as you would like but may still provide the
    functionnalities you are looking for.

    2009/2/17 List.rb <>

    >
    >
    >
    >
    > On Feb 17, 2009, at 2:26 AM, sa 125 <> wrote:
    >
    > I'm running ubuntu linux on an office network with mostly windows
    >> machines. I have a shared network folder that I can access with samba
    >> as:
    >>
    >> smb://hostname/shared
    >>
    >> I'm trying to write a script that will read the contents of that shared
    >> folder, but can't access it using the above address. I tried to print
    >> the content:
    >>
    >> Dir.entries('smb://hostname/shared').each { |e| puts e }
    >>
    >> But obviously got a no such directory error. I know this isn't the way
    >> to go, but I can't figure out how to read that location.
    >>
    >> Any tips will be great - thanks!
    >> --
    >> Posted via http://www.ruby-forum.com/.
    >>
    >>

    >
    > From the windows clients, Dir["\\\\server\\share\\*"]
    >
    > From the samb server, just use the actual directory that's mounted.
    >
    > For other nix hosts, I would setup nfs mount points
    >
    >
     
    Louis-Philippe, Feb 17, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Granger Godbold
    Replies:
    3
    Views:
    5,069
    Granger Godbold
    Jul 3, 2004
  2. john bailo

    using SMB as filesystem mounts

    john bailo, Sep 10, 2003, in forum: Java
    Replies:
    3
    Views:
    410
    Davide Consonni
    Sep 11, 2003
  3. Atila Olah

    Python and SMB, again...

    Atila Olah, Sep 12, 2005, in forum: Python
    Replies:
    4
    Views:
    3,184
    Atila Olah
    Sep 14, 2005
  4. Ronnie Kwok

    Connecting to SMB share in python

    Ronnie Kwok, Sep 25, 2008, in forum: Python
    Replies:
    4
    Views:
    5,485
    Tim Golden
    Sep 25, 2008
  5. John
    Replies:
    0
    Views:
    181
Loading...

Share This Page