[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Dir[] and Windows Network Addresses

Berger, Daniel

6/23/2005 9:37:00 PM

> -----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?

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.




8 Answers

Charles Mills

6/23/2005 9:54:00 PM

0

Berger, Daniel wrote:
> > -----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?
>
> 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

nobu.nokada

6/23/2005 11:41:00 PM

0

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


Brian Takita

6/30/2005 10:28:00 PM

0

That works, thank you.

Rick Saunders

7/23/2011 5:22:00 PM

0

On Jul 8, 3:57 am, rfisc...@sonic.net (Ray Fischer) wrote:
> Ernst Blofeld  <blofel...@hotmail.com> wrote:
>
> >I guess liberals think it's OK to hold detainees in secret prisons
>
> No, that's still you fascist rightards.

Raytard rule #1: When he can't refute the facts,
whine, whine some more, keep whining, and change
the subject so that he looks like a Raytard.

Topaz

7/27/2011 10:43:00 AM

0


Here is a quote from Mein Kampf:

"The fight which Fascist Italy waged against Jewry's three
principal weapons, the profound reasons for which may not have been
consciously understood (though I do not believe this myself) furnishes
the best proof that the poison fangs of that Power which transcends
all State boundaries are being drawn, even though in an indirect way.
The prohibition of Freemasonry and secret societies, the suppression
of the supranational Press and the definite abolition of Marxism,
together with the steadily increasing consolidation of the Fascist
concept of the State--all this will enable the Italian Government, in
the course of some years, to advance more and more the interests of
the Italian people without paying any attention to the hissing of the
Jewish world-hydra.
"The English situation is not so favorable. In that country
which has 'the freest democracy' the Jew dictates his will, almost
unrestrained but indirectly, through his influence on public opinion."


http://ww... http://www.... http://www...

http://here... http://immigration-globalization.blo...

NEMO

7/27/2011 5:18:00 PM

0

On Jul 27, 6:43 am, Topaz <mars1...@hotmail.com> wrote:

Here are some quotes from Mein Kampf

Gobble - gobble, slurp - slurp, faggot!

\Y/
^
( )
I I
I I
OI IO

*US*

7/28/2011 2:02:00 AM

0

Oh, and btw, it can and will happen again.

http://www.benzinga.com/news/11/07/1789905/forget-anonymous-evidence-suggests-gop-hacked-stole-200...

The founders of the USA fought for representation in government.

Topaz

7/29/2011 1:07:00 AM

0


Here are some quotes from Mein Kampf:

"Human progress and human cultures are not founded by the
multitude. They are exclusively the work of personal genius and
personal efficiency."

"Does anybody honestly believe that human progress originates in
the composite brain of the majority and not in the brain of the
individual personality?"

"The devastating influence of the parliamentary institution might
not easily be recognized by those who read the Jewish Press, unless
the reader has learned how to think independently and examine the
facts for himself. This institution is primarily responsible for the
crowded inrush of mediocre people into the field of politics.
Confronted with such a phenomenon, a man who is endowed with real
qualities of leadership will be tempted to refrain from taking part in
political life; because under these circumstances the situation does
not call for a man who has a capacity for constructive statesmanship
but rather for a man who is capable of bargaining for the favour of
the majority. Thus the situation will appeal to small minds and will
attract them accordingly."

"One truth which must always be borne in mind is that the majority
can never replace the man. The majority represents not only ignorance
but also cowardice. And just as a hundred blockheads do not equal one
man of wisdom, so a hundred poltroons are incapable of any political
line of action that requires moral strength and fortitude."

"It is not the aim of our modern democratic parliamentary system
to bring together an assembly of intelligent and well-informed
deputies. Not at all. The aim rather is to bring together a group of
nonentities who are dependant on others for their views and who can
be all the more easily led, the narrower the mental outlook of each
individual is. That is the only way in which a party policy, according
the the evil meaning it has to-day, can be put into effect. And by
this method alone is it possible for the wirepuller, who exercises the
real control, to remain in the dark, so that personally he can never
be brought to account for his actions."

"Such people would raise an outcry, if, for instance, anyone
should attempt to set up a dictatorship, even though the man
responsible for it were Frederick the Great and even though the
politicians for the time being, who constituted the parlimentary
majority, were small and incompetent men or maybe even on a lower
grade of inferiority; because to such sticklers for abstract
principles the law of democracy is more sacred than the welfare of the
nation."

"the best form of government is that which makes it quite natural for
the best brains to reach a position of dominant importance and
influence in the community."

http://ww... http://www.... http://www...

http://here... http://immigration-globalization.blo...