Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby read Samba share

Tags:

ruby

samba

smb

I'm looking for a way to read from a samba share. I want to use it like the Dir class, for example open and read of directories. Is this possible in Ruby?

like image 512
mibo Avatar asked Oct 10 '22 18:10

mibo


1 Answers

The Sambala gem should work for you if your host OS is a Posix (UNIX-like) system (not sure about Windows...):

gem install sambala

This gem will work as long as your host OS has a working smbclient executable somewhere in your $PATH. As long as you're using Mac OS X, Linux, or some other UNIX variant, you should be able to run the following command from the terminal to see if you've got smbclient somewhere in your path:

which smbclient

If you don't get a result, do a google search on how to obtain smbclient for your current host OS. If you're on Mac OS X, you can simply install MacPorts and then run the following command from the terminal to get smbclient installed:

sudo port install samba3
like image 152
lottscarson Avatar answered Oct 13 '22 10:10

lottscarson