[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Newbie-Script for copying matching files to new destination

Os Ai

5/13/2009 5:21:00 PM

Hi,
Being new to Ruby,am not sure if it can do these but if it can then
someone please help.My challenge is that I want to copy certain files
from a source location with filenames containing words listed in a text
file to a new location. Any help would be most appreciated.Thanks in
advance.
--
Posted via http://www.ruby-....

10 Answers

Robert Klemme

5/13/2009 6:31:00 PM

0

On 13.05.2009 19:21, Os Ai wrote:
> Being new to Ruby,am not sure if it can do these but if it can then
> someone please help.My challenge is that I want to copy certain files
> from a source location with filenames containing words listed in a text
> file to a new location. Any help would be most appreciated.Thanks in
> advance.

I am not sure what you are asking for... How about:

1. read words from file
2. enumerate all files in the source location and check each name for a
match
3. if there is a match copy the file from source to target

Cheers

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestprac...

Os Ai

5/13/2009 6:43:00 PM

0

Robert Klemme wrote:
> On 13.05.2009 19:21, Os Ai wrote:
>> Being new to Ruby,am not sure if it can do these but if it can then
>> someone please help.My challenge is that I want to copy certain files
>> from a source location with filenames containing words listed in a text
>> file to a new location. Any help would be most appreciated.Thanks in
>> advance.
>
> I am not sure what you are asking for... How about:
>
> 1. read words from file
> 2. enumerate all files in the source location and check each name for a
> match
> 3. if there is a match copy the file from source to target
>
> Cheers
>
> robert

Hi Robert,
Yes you got it. I guess you know how to speak 'programming' which I
obviously don't.So how do I go about it?

--
Posted via http://www.ruby-....

Robert Klemme

5/13/2009 7:12:00 PM

0

On 13.05.2009 20:43, Os Ai wrote:
> Robert Klemme wrote:
>> On 13.05.2009 19:21, Os Ai wrote:
>>> Being new to Ruby,am not sure if it can do these but if it can then
>>> someone please help.My challenge is that I want to copy certain files
>>> from a source location with filenames containing words listed in a text
>>> file to a new location. Any help would be most appreciated.Thanks in
>>> advance.
>> I am not sure what you are asking for... How about:
>>
>> 1. read words from file
>> 2. enumerate all files in the source location and check each name for a
>> match
>> 3. if there is a match copy the file from source to target

> Yes you got it. I guess you know how to speak 'programming' which I
> obviously don't.So how do I go about it?

Assuming you are completely new to programming you probably want to
start here http://pine.fm/Learn... or with any other introductory
tutorial for Ruby and then look up documentation about these core and
standard library classes

String
Array
File
Dir
Find

You'll find it here http://www.ruby-doc.org/core-1.9/... and
http://www.ruby-doc.o.... You can also find some hints about
file reading in our blog, although I suggest you first consider Chris's
book:

http://blog.rubybestpractices.com/posts/rklemme/001-Using_blocks_for_Robus...


Kind regards

robert

Os Ai

5/13/2009 10:25:00 PM

0

Hi Robert,
Thanks for even taking time to write and even advice.Am indeed
grateful.I would research on all the literature since am new to Ruby.I
would still like to be guided on how to go about it as I need it
urgently.Thanks
--
Posted via http://www.ruby-....

Robert Klemme

5/14/2009 8:12:00 AM

0

2009/5/14 Os Ai <osasuyiaigbe@gmail.com>:
> Thanks for even taking time to write and even advice.Am indeed
> grateful.I would research on all the literature since am new to Ruby.I
> would still like to be guided on how to go about it as I need it
> urgently.Thanks

Learning and urgency do not mix well. If you are new to programming
you cannot expect to learn it overnight.

This forum is generally very helpful, however to me it feels like this
question has "do my (home) work for me" written all over it. You have
not demonstrated that you followed advice given or what you attempted
yourself yet expect "guidance" and try to push us. This usually does
not work well with volunteers. For more elaborate explanations please
read:

http://catb.org/esr/faqs/smart-questions.h...

Regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestprac...

Os Ai

5/15/2009 7:43:00 AM

0

Thanks for your post. You have raised very valid points. I am learning
and hopefully would be able to find a solution in a few days. Thanks
again.
--
Posted via http://www.ruby-....

Barry OGrady

1/31/2012 3:40:00 AM

0

On Mon, 30 Jan 2012 20:55:30 -0600, "(?`?.? Craig Chilton ?.???)
wrote:

> The TWO-PRONGED Strategy for *Hastening* the DEMISE
> of the Hate-Agendas Against Girls, Women, and Gays
> on the Part of the Bigots of the RRR & LDS Cults

....is not working.

=-=-=-=-==-=-=-=
God is a spirit. 0% proof!

Bob

1/31/2012 11:18:00 AM

0


The TWO-PRONGED Strategy for *Hastening* the DEMISE
of the Hate-Agendas Against Girls, Women, and Gays
on the Part of the Bigots of the RRR & LDS Cults

"Jon Young"/"Auric Hellman" on 4-26-11, wrote:

> Your continued posting to Usenet...

...is a very effective, 2-pronged method of UNDERMINING the hateful
agendas against the harmless and beneficial personal liberties of bigoted
LOSERS like you, which contribute to the *hastening* of the day when
those agendas will lie mouldering and dead at the bottom of the Drain of
Extinction -- right alongside the bones of the EQUALLY-loathsome and -mor-
onic agendas of the segregationists, never to be heard from again. The
two prongs of that dissembling of those agendas, here in Usenet (not even
counting the many OTHER ways I do that) are:

(1) Marshall and present the FACTS that wreck the agendas by
revealing the *speciousness* of them. And point out something
that the bigots can NEVER refute -- that their emperor (the agen-
das have NO clothes (facts.) NO facts even EXIST that they can
bring to bear to defend or support their moronic and ludicrous
agendas. (Which is why the RRR and LDS Cults **depend** on
appealing to the lowest-intellect level of Americans for recruit-
ment and maintenance as their lemmings to be their cash cows
and propaganda-PARROTS. It take a *massive* amount of GUL-
LIBILITY to fall for the LIES that the leaders constantly spew.

(2) Spur the bigots into making total FOOLS of themselves by posting
the most ABSURD crap imaginable. Thus helping to raise the cons-
ciouness of society to the realization that it would be more worth-
while to attend a rat fight than to have ANYTHING to do with the
hate-agendas or the bigots that espouse and tout them.

A **VERY** effective combination. Which becomes even MORE so
whenever readers FORWARD or RE-PUBLISH any of the above-describ-
ed material.

The progress of the hate-agendas to their DOOM is inexorable and
once that has happened, their extinction will be irreversible and irrevo-
cable.

The *agendas* will be remembered by society only with REVULSION.

The "bigots* will be remembered by society only with DERISION.

The SAME well-deserved fate that befell the segregationists.

Good RIDDANCE to *putrid* garbage! One less TOXIN in American
society. America WILL become a Bigotry-Free Zone.

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

= = = = = = = = = = = = = = = = = = = = =

??? Rest in Peace ???
??? George Richard Tiller, MD ???
??? A True American HERO! ???
??? August 8, 1941 ? May 31, 2009 ???
??? Visit -- http://iamdr... ???

"He saved the lives of thousands of women who would've
died otherwise, thousands who would've been made sterile
or gravely injured by childbirth. He knew his life was at grave
risk. Dr. Tiller was a true Saint."

= = = = = = = = = = = = = = = = = = = = =

-- Craig Chilton (E-Mail me if you wish, from websites below.)

http://www.Layoff... -- Unemployment Solution!
http://www.ChristianEgali... -- Fight the hateful RRR Cult!
http://apifar.bl... -- Tactics: Defending Human Rights
http://pro-christian.bl... -- Exposing RRR Cult Bigotry
http://www.shadowandil... -- Learn "The LOPAQUA Secret!"
http://www.Travel... -- Learn how to get PAID to TRAVEL!

Bill Taylor

1/31/2012 5:46:00 PM

0

In article <5olei752ine3l9dvhmcjs3stb4u42pc7pi@4ax.com>
"(?`?.? Craig Chilton ?.???) <http://wwwdrtuertuertuet.org...
<b@c.com> wrote:
>
> On 31 Jan 2012 01:59:07 -0000,
> SUBMORONIC & BIGOTED LOWLIFE, "Bill Taylor,"
> (aka "Chuck Dejong") <chuckd@msn.com> spewed:

Everybody is me.

> [ ... ]
>
> > It's about fucking time! If a bunch of queers can't make
> > up their mind what gender they are - make it up for 'em!
>
> THANKS for once AGAIN *reminding* everyone that a
> person has to be a SUBMORON to be a QUEER, "Taylor."

You're welcome, don't mention it.

Bob

1/31/2012 7:13:00 PM

0

On Tue, 31 Jan 2012 18:45:37 +0100,
BIGOTED LOWLIFE,
Bill Taylor <nobody@nymu.eu> wrote:
>"(?`?.? Craig Chilton ?.???)
<http://www.TravelForP... wrote:
>> SUBMORONIC & BIGOTED LOWLIFE, "Bill Taylor,"
>> (aka "Chuck Dejong") <chuckd@msn.com> spewed:


[ ... ]

>>> It's about fucking time! If a bunch of queers can't make
>>> up their mind what gender they are -- make it up for 'em!

>> THANKS for once AGAIN *reminding* everyone that a
>> person has to be a SUBMORON to be a BIGOT, "Taylor."

> You're welcome, don't mention it.

Nice of you to *acknowledge, that, bigot!