Newbie-Script for copying matching files to new destination

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.

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

Robert K. 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?

On 13.05.2009 20:43, Os Ai wrote:

  1. enumerate all files in the source location and check each name for a
    match
  2. 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/LearnToProgram/ 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 RDoc Documentation and
RDoc Documentation. 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_Robustness.html

Kind regards

robert

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

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.

2009/5/14 Os Ai [email protected]:

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.html#urgent

Regards

robert