Watch the single versus double quotes. However, that's not the problem
anway.
Specifying the root makes it fail:
irb(main):019:0> Dir["*.*"]
=> ["AUTOEXEC.BAT", "boot.ini"] # Much snippage
irb(main):016:0> Dir["C:\\*.*"]
=>
However, Dir.entries should do the trick in the meantime:
irb(main):017:0> Dir.entries("\\\\vadevweb\\public")
=> [".", "..", "Builds", "Devtools", "Projects", "vss"]
Looks like a bug in Dir.glob to me.
Regards,
Dan
PS - Find.find seems to handle UNC paths alright, too.
···
-----Original Message-----
From: Brian Takita [mailto:brian.takita@gmail.com]
Sent: Thursday, June 23, 2005 3:11 PM
To: ruby-talk ML
Subject: Dir and Windows Network Addresses
Hello,
Is is possible to get the contents of a Windows network
directory using Dir?
I would think it would be something like
Dir['\\\\Computer\\Dir\\*'] but nothing shows up.
Is there a way to access the a Windows network directory
without having to call exec 'dir \\\\Computer\\Dir' and
parsing the output?
Berger, Daniel wrote:
> From: Brian Takita [mailto:brian.takita@gmail.com]
> Sent: Thursday, June 23, 2005 3:11 PM
> To: ruby-talk ML
> Subject: Dir and Windows Network Addresses
>
>
> Hello,
>
> Is is possible to get the contents of a Windows network
> directory using Dir?
>
> I would think it would be something like
> Dir['\\\\Computer\\Dir\\*'] but nothing shows up.
>
> Is there a way to access the a Windows network directory
> without having to call exec 'dir \\\\Computer\\Dir' and
> parsing the output?
Watch the single versus double quotes. However, that's not the problem
anway.
Specifying the root makes it fail:
irb(main):019:0> Dir["*.*"]
=> ["AUTOEXEC.BAT", "boot.ini"] # Much snippage
irb(main):016:0> Dir["C:\\*.*"]
=>
However, Dir.entries should do the trick in the meantime:
irb(main):017:0> Dir.entries("\\\\vadevweb\\public")
=> [".", "..", "Builds", "Devtools", "Projects", "vss"]
Looks like a bug in Dir.glob to me.
Yeah, this is funny:
irb(main):001:0> Dir['C:\\*.*']
=>
irb(main):002:0> Dir['C:/*.*']
=> ["C:/AUTOEXEC.BAT", "C:/BOOT.INI", "C:/BOOTSECT.DOS",
"C:/COMLOG.txt", "C:/CONFIG.SYS", "C:/DELL.SDR", "C:/hiberfil.sys",
"C:/IO.SYS", "C:/MSDOS.SYS", "C:/NTDETECT.COM", "C:/pagefile.sys",
"C:/volumeid.zbx"]
That was using the irb from the 1-click installer, same thing happens
using Ruby on Cygwin.
-Charlie
···
> -----Original Message-----
Hi,
At Fri, 24 Jun 2005 06:36:50 +0900,
Berger, Daniel wrote in [ruby-talk:146310]:
However, Dir.entries should do the trick in the meantime:
irb(main):017:0> Dir.entries("\\\\vadevweb\\public")
=> [".", "..", "Builds", "Devtools", "Projects", "vss"]
Looks like a bug in Dir.glob to me.
Not a bug. Backslash is a metacharacter, so you have to use
forward slashes instead.
Dir.entries("//vadevweb/public")
···
--
Nobu Nakada