This seems like it should be a simple solution, but I don’t know
enough Ruby to do it. I am using Ruby 1.8.4. What I want to do is
browse a directory on a different computer (server) than the one
running Ruby. I know I can use Dir to browse directories, but I can’t
get it to find the other server where the files are stored. Any help
is greatly appreciated.
Anthony wrote:
This seems like it should be a simple solution, but I don’t know
enough Ruby to do it. I am using Ruby 1.8.4. What I want to do is
browse a directory on a different computer (server) than the one
running Ruby. I know I can use Dir to browse directories, but I can’t
get it to find the other server where the files are stored. Any help
is greatly appreciated.
Well you need to choose protocol - proably should take a look at ruby
implementation of Ftp.
have fun and remember about uncle google
I don’t want FTP. I just want the program to look into the directory
and see whats there. Google has not been much help at all.
Using Ruby 1.8.6, I can use Dir[‘servername’] and see what’s there.
This doesn’t work in Ruby 1.8.4. I can use Dir[‘C:/’] but can’t get it
to jump to another server. If nothing else, is there an easy way to
update to Ruby 1.8.6? Will I have to reconfigure my servers?
Anthony wrote:
I don’t want FTP. I just want the program to look into the directory
and see whats there. Google has not been much help at all.Using Ruby 1.8.6, I can use Dir[‘servername’] and see what’s there.
This doesn’t work in Ruby 1.8.4. I can use Dir[‘C:/’] but can’t get it
to jump to another server. If nothing else, is there an easy way to
update to Ruby 1.8.6? Will I have to reconfigure my servers?
Well you don’t seem to understand that you’re using samba protocol
without knowing about it.
updating is really easy, but that depends on your system.
On Nov 27, 2007, at 10:10 AM, Anthony wrote:
I don’t want FTP. I just want the program to look into the directory
and see whats there. Google has not been much help at all.Using Ruby 1.8.6, I can use Dir[‘servername’] and see what’s there.
This doesn’t work in Ruby 1.8.4. I can use Dir[‘C:/’] but can’t get it
to jump to another server. If nothing else, is there an easy way to
update to Ruby 1.8.6? Will I have to reconfigure my servers?
That sounds like using SMB to access a windows file server. That’s no
less complicated than ‘FTP’, except that your operating system lets
you mount those shares as a local-seeming filesystem. Try “\
\servername\share\folder” – the doubling to escape the
backslashes, which are special in ruby strings.
Upgrade /what/ to Ruby 1.8.6? You haven’t given any details of your
setup, not even OS.
It’s not “Just” a directory to look in. It’s a remote share, with
authentication, network failure scenarios, the whole bit. Your OS
just fakes it partly, I suspect.
authentication, network failure scenarios, the whole bit. Your OS
just fakes it partly, I suspect.
I am using Dir to access a different computer on the same local
network. It allows me to browse a directory and see what files are in
it. This works fine with Ruby 1.8.6, but not Ruby 1.8.4.
On updating, the computer is Windows XP Professional. Ruby is 1.8.4,
Rails is 1.2.3, Gems is 0.9.4. I would like to update Ruby to 1.8.6
without affecting the others, if possible. The server setup is
lighttpd server which will proxy back to Mongrel servers. This is not
my server setup - I inherited it - so I don’t know much about it.
On Nov 27, 2007, at 12:55 PM, Anthony wrote:
authentication, network failure scenarios, the whole bit. Your OS
my server setup - I inherited it - so I don’t know much about it.
There were some changes in Ruby 1.8.6, and even more so in the
packaging for it. I’m not sure what the options of Windows binaries
of ruby are these days, but I wouldn’t think it’s too hard to install
new ones.
–Aria (Non-windows-user)
Sometimes I would rather be a Non-windows-user, but the work
environment is Windows.
All of the tutorials I have seen are for installing Ruby the first
time. I just want to update what I already have. Someone else has
tried to install the newer version, but they said it wouldn’t
overwrite the current files. Do I have to uninstall them and then
install the new version? Since I didn’t set up the servers, I don’t
really want to lose the settings and have to redo them.
Thank you both for your help.
You are using SMB share transparently, that confirms it.
new ruby probably uses diffirent filesystem calls to WinAPI that’s why
It can transparently use smb shares, use SMB bindings or just upgrade
ruby - it’s quiteeasy and there’s bunch of tutorials out there.
Since I didn’t set up the servers, I don’t
really want to lose the settings and have to redo them.
Only chiming in to wish you good luck on it
It doesnt sound pleasant, but normally from my experience
simply removing the old files and then installing the new
ruby should be enough. But in a way, if you are too
anxious you could always write a few wrapper .rb files
to get 1.8.6 (or look at the diff) so its i think a
problem which will be solved over a little invested
time too imho …
On Nov 27, 4:19 pm, Marc H. [email protected] wrote:
time too imho …
![]()
Posted viahttp://www.ruby-forum.com/.
You’re right, it’ll take invested time. I just want to do it as
painlessly as I can. The apps are important, so I don’t want to mess
with the environment any more than I have to.
On Nov 27, 2007 11:10 AM, Anthony [email protected] wrote:
I don’t want FTP. I just want the program to look into the directory
and see whats there. Google has not been much help at all.
Try:
Dir[‘//servername/share/directory/*’]
Using Ruby 1.8.6, I can use Dir[‘servername’] and see what’s there.
This doesn’t work in Ruby 1.8.4. I can use Dir[‘C:/’] but can’t get it
to jump to another server. If nothing else, is there an easy way to
update to Ruby 1.8.6? Will I have to reconfigure my servers?
Here’s what I would do. If you have ruby installed to e.g. C:\ruby,
rename the directory to C:\ruby184. Then install the newer version to
C:\ruby and install necessary gems. If you run into a problem,
switch the folders back.
hth
Gordon
Just to be the bastard computer nerd from heck,
You do not want to use a regular FTP server for sharing files between
systems
unless security is a very low priority, if FTP like work is needed use
SFTP
for
corns sake… Use of FTP in a production environment might not be
S.M.A.R.T.
The best solution is a distributed or network aware file system of some
sort,
such as SMB, NFS, or AFS, e.t.c. SMB leaves a fair bit to be desired
IMHO
and
NFS is not secure, the Andrew File System (AFS) I have no experience
with.
either way that means a client and server on both systems.
Windows has built in support for SMB (client/server) and a built in FTP
client
probably stolen from old BSD code going by the looks of it.
Most GNU/Linux, *BSD, and Unix systems have support (client and server)
for
SMB,
NFS, FTP, and occasionally AFS included.
Gordon, Dir[’//servername/share/directory/*’] is what I had been using
previously, I just inadvertently left off the ‘//’ in my previous
post. Anyway, that format is correct. Your advice is also how I would
approach updating Ruby. However, my boss has decided to wait on
updating since we don’t necessarily need to at this time.
Terry, I appreciate the help with FTP, but FTP, or something like it,
is more than I need. The program just needs to show the files in the
directory, not actually allow someone to do anything (no getting the
files, no adding new files). That problem is now solved.
Botp, that is more the format I needed, just a simpler version.
Thanks to everyone who posted and offered advice. I appreciate all
your help. I am considering the problem solved and the thread closed,
unless someone has additional advice for updating Ruby versions.
On Nov 28, 2007 12:05 AM, Anthony [email protected] wrote:
This seems like it should be a simple solution, but I don’t know
enough Ruby to do it. I am using Ruby 1.8.4. What I want to do is
browse a directory on a different computer (server) than the one
running Ruby. I know I can use Dir to browse directories, but I can’t
get it to find the other server where the files are stored. Any help
is greatly appreciated.
this is just a simple example,
C:\family\ruby>irb
±--------------------------------------------------------+
| hello, botp |
| this is the irb conf (find me at C:/family/ruby/.irbrc) |
| happy irb/rubying. |
| you can now enter ruby commands |
| type “quit” anytime to exit irb… |
±--------------------------------------------------------+
system ‘dir \\bgdc01\c$\download’
Volume in drive \bgdc01\c$ has no label.
Volume Serial Number is 281F-1297
Directory of \bgdc01\c$\download
11/27/2007 04:44 PM .
11/27/2007 04:44 PM …
11/27/2007 03:37 PM 38,184
botp_sample_dmpi_security_log_2007_nov_27
.evt
11/24/2007 04:52 PM 26,112 fastthread-1.0-mswin32.gem
11/17/2007 02:43 PM 1,787,060 npp.4.5.Installer.exe
10/08/2007 11:02 AM 10,590,471 ruby-1.8.6-p111-i386-mswin32.zip
4 File(s) 12,441,827 bytes
2 Dir(s) 29,531,443,200 bytes free
#=> true
system ‘echo test create file > \\bgdc01\c$\download\testing.txt’
#=> true
system ‘dir \\bgdc01\c$\download’
Volume in drive \bgdc01\c$ has no label.
Volume Serial Number is 281F-1297
Directory of \bgdc01\c$\download
11/28/2007 04:06 PM .
11/28/2007 04:06 PM …
11/27/2007 03:37 PM 38,184
botp_sample_dmpi_security_log_2007_nov_27
.evt
11/24/2007 04:52 PM 26,112 fastthread-1.0-mswin32.gem
11/17/2007 02:43 PM 1,787,060 npp.4.5.Installer.exe
10/08/2007 11:02 AM 10,590,471 ruby-1.8.6-p111-i386-mswin32.zip
11/28/2007 04:06 PM 19 testing.txt
5 File(s) 12,441,846 bytes
2 Dir(s) 29,531,377,664 bytes free
#=> true
system ‘type \\bgdc01\c$\download\testing.txt’
test create file
#=> true
system ‘dir \\bgdc01\c$\download\testing.txt’
Volume in drive \bgdc01\c$ has no label.
Volume Serial Number is 281F-1297
Directory of \bgdc01\c$\download
11/28/2007 04:06 PM 19 testing.txt
1 File(s) 19 bytes
0 Dir(s) 29,531,115,520 bytes free
#=> true
system ‘dir test.rb’
Volume in drive C is hd
Volume Serial Number is 7CD8-B514
Directory of C:\family\ruby
11/24/2007 01:06 PM 362 test.rb
1 File(s) 362 bytes
0 Dir(s) 2,659,557,376 bytes free
#=> true
require ‘FileUtils’
#=> true
include FileUtils
#=> Object
cp ‘test.rb’, ‘\\bgdc01\c$\download\’
#=> nil
system ‘dir \\bgdc01\c$\download\’
Volume in drive \bgdc01\c$ has no label.
Volume Serial Number is 281F-1297
Directory of \bgdc01\c$\download
11/28/2007 04:23 PM .
11/28/2007 04:23 PM …
11/27/2007 03:37 PM 38,184
botp_sample_dmpi_security_log_2007_nov_27
.evt
11/24/2007 04:52 PM 26,112 fastthread-1.0-mswin32.gem
11/17/2007 02:43 PM 1,787,060 npp.4.5.Installer.exe
10/08/2007 11:02 AM 10,590,471 ruby-1.8.6-p111-i386-mswin32.zip
11/28/2007 04:23 PM 362 test.rb
11/28/2007 04:06 PM 19 testing.txt
6 File(s) 12,442,208 bytes
2 Dir(s) 29,530,783,744 bytes free
#=> true
note, i’m accessing thru an admin share (not commonly adviseable)
kind regards -botp