> Users.find(:all).each do |u|
>   mkdir "/logos/#{u.id}"
>   cp_r "/users/#{u.login[0..0]}/#{u.login}/logos/.", "/logos/#{u.id}"
> end

Thanx for reply. It almost works but... what if a particular user does 
not have logo image or even he doesn't have path like above? I supposed 
there should be Dir.glob with "empty?" used somewhere in the code.

I wrote something like this:

require "fileutils"
include FileUtils

User.find(:all,:limit=>'20').each do |u|
  mkdir "public/uploaded/logos/#{u.id}"
  cp_r "public/uploaded/users/#{u.login[0..0]}/#{u.login}/logo/.", 
"public/uploaded/logos/#{u.id}" unless 
Dir.glob("public/uploaded/users/#{u.login[0..0]}/#{u.login}/logo").empty?
end

Ugly but it seems to be working.

I have another question: how to force this script to copy only jpg, png 
and gif files from the "logo" directory? (there are also some mouldy php 
files I don't need ANYMORE)
-- 
Posted via http://www.ruby-forum.com/.