On Fri, Nov 12, 2010 at 6:41 AM, Bal Sidhu <balvir.sidhu / gmail.com> wrote:
> Hi
> Can someone here please help/guide me how I can implement the following
> scenario.
>
> Scenario:
>
> A directory on my Mac has list of Sub-directories, What I need is Ruby
> script that finds the Sub Directory that was Last Modified based on the
> modified date and then copy that Sub Directory and it is content to my
> Different Dir on my Mac.
>
> Appreciate your much needed help

This should get you started:

irb(main):001:0> Dir["*"].select {|f| test ?d, f}
=> ["a1", "bin", "desktop", "doc", "lib", "ruby", "vimfiles"]
irb(main):002:0> Dir["*"].select {|f| test ?d, f}.sort_by {|f| File.mtime f}
=> ["lib", "vimfiles", "ruby", "a1", "doc", "bin", "desktop"]

Cheers

robert

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