Difference between dir/**/* and dir/*?

I’ve noticed the following when specifying a wildcard array of files:

dir/**/*

dir/*

What’s the difference?

Thanks for your help.

Ben J. wrote:

dir/**/*

dir/*

What’s the difference?

dir/* gives you all (non-hidden) files in the directory dir.
dir/**/* gives you all (non-hidden) files in the director dir and its
subdirectories.

HTH,
Sebastian

Sebastian H. wrote:

Ben J. wrote:

dir/**/*

dir/*

What’s the difference?

dir/* gives you all (non-hidden) files in the directory dir.
dir/**/* gives you all (non-hidden) files in the director dir and its
subdirectories.

HTH,
Sebastian

Thanks for your help, what about its sub-sub directories? Is dir/**/*
recursive?

Ben J. wrote:

what about its sub-sub directories? Is dir/**/* recursive?

Yes.

I’m trying to figure out how to check memory usage while my program is
running, but I have no idea how, and many Google searches of it have not
resulted in anything useable. Anyone have any ideas on how to do this? I
need to know in kilobytes how much memory is being used.

~ J

top
F
N

On Mon, 2008-09-01 at 06:54 +0900, d c wrote:

top
F
N

Well, it ain’t exactly that simple. First of all, “top” runs only on
Unix-like systems, and sometimes needs to be installed. Second, the
numbers “top” gives you are only as good as what it gets from the
kernel. “top” in Linux, for example, is notoriously bad at estimating
memory usage because it depends on some things in the /proc filesystem
that are “less than correct”.

I’ll assume Linux. In fact, not only will I assume Linux, but I’ll also
assume you have the 2.6.25 kernel or later. Then you can do this:

http://tinyurl.com/3a56dq

HTH :wink:

M. Edward (Ed) Borasky
ruby-perspectives.blogspot.com

“A mathematician is a machine for turning coffee into theorems.” –
Alfréd Rényi via Paul Erdős

Sorry, I should have specified that I’m using Windows XP SP2 :\

However, I want the program to be able to run on Linux, Windows, and Mac
without difficulty, though Windows is my primary concern. I can figure
out
how to choose which way to measure on a different platform but I don’t
know
how to measure it in the first place. ^^;


From: “M. Edward (Ed) Borasky” [email protected]
Sent: Sunday, August 31, 2008 5:13 PM
To: “ruby-talk ML” [email protected]
Subject: Re: Measuring Memory Usage

On Mon, 2008-09-01 at 09:10 +0900, M. Edward (Ed) Borasky wrote:

memory usage because it depends on some things in the /proc filesystem
that are “less than correct”.

I’ll assume Linux. In fact, not only will I assume Linux, but I’ll also
assume you have the 2.6.25 kernel or later. Then you can do this:

http://tinyurl.com/3a56dq

HTH :wink:

Some amendments to the links:

http://lwn.net/Articles/230975/

http://kernelnewbies.org/Linux_2_6_25#head-5a75e29195ffa59bfa5428ca28702e2e7df8f2ad


M. Edward (Ed) Borasky
ruby-perspectives.blogspot.com

“A mathematician is a machine for turning coffee into theorems.” –
Alfréd Rényi via Paul Erdős

From: AzimuthDragon [mailto:[email protected]]

Sorry, I should have specified that I’m using Windows XP SP2 :\

However, I want the program to be able to run on Linux,

Windows, and Mac without difficulty, though Windows is my primary

concern. I can figure out how to choose which way to measure on

a different platform but I don’t know

how to measure it in the first place. ^^;

in that case, you’ll have to familiarize yourself w windows (or any os
for that matter).

on windows, one way is using tasklist.

eg, to get the mem usage of putty,

C:\family\ruby>ruby -e “p tasklist.grep(/putty.exe/i)”
[“PUTTY.EXE 3988 Console 0 596 K\n”]

if there are many putty instances, you’ll know wc one by their pids.

to get more tips, ask your system admin.

kind regards -botp

On Mon, 2008-09-01 at 11:01 +0900, AzimuthDragon wrote:

Sorry, I should have specified that I’m using Windows XP SP2 :\

However, I want the program to be able to run on Linux, Windows, and Mac
without difficulty, though Windows is my primary concern. I can figure out
how to choose which way to measure on a different platform but I don’t know
how to measure it in the first place. ^^;

Well … on Windows, there’s a well-defined API to pull performance data
from the registry, so you’d just need to hunt down that documentation
and write Ruby code to go pick it up and format it however you want.
There are Perl modules on CPAN that do this, so the time-honored cheat
of taking a Perl module and translating it by hand to Ruby will probably
get you going fairly quickly.

On Linux, chase down the links I posted in an earler message. On Macs or
Solaris, the best plan is probably to use “dtrace” to collect the data
externally to your Ruby process(es) and just write Ruby post-processing
scripts.

M. Edward (Ed) Borasky
ruby-perspectives.blogspot.com

“A mathematician is a machine for turning coffee into theorems.” –
Alfréd Rényi via Paul Erdős

On Sun, 31 Aug 2008 16:06:34 +0900, Ben J. wrote:

I’ve noticed the following when specifying a wildcard array of files:

dir/**/*

This does a deep fetch: all files in all subdirectories of “dir”

dir/*

Only the files in “dir”.

2008/8/31 Ben J. [email protected]:

subdirectories.

HTH,
Sebastian

Thanks for your help, what about its sub-sub directories? Is dir/**/*
recursive?

Ruby documentation is often said to be bad - but not that bad that
you would not find these things explained.

http://www.ruby-doc.org/core-1.8.7/classes/Dir.html#M000077

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs