# Getting started with Rake - how do I copy a directory of assets to RAILS\_ROOT + "/public"

**URL:** <https://www.ruby-forum.com/t/getting-started-with-rake-how-do-i-copy-a-directory-of-assets-to-rails-root-public/175168>\
**Category:** Rails\
**Created:** [September 9, 2009, 9:19am UTC](https://www.ruby-forum.com/t/getting-started-with-rake-how-do-i-copy-a-directory-of-assets-to-rails-root-public/175168 "2009-09-09T09:19:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kristian](https://www.ruby-forum.com/u/Kristian)\
**Post date:** [September 9, 2009, 9:19am UTC](https://www.ruby-forum.com/t/getting-started-with-rake-how-do-i-copy-a-directory-of-assets-to-rails-root-public/175168/1 "2009-09-09T09:19:35Z")

</div>

I am just getting started with Rake. I am trying to create a rake task  
from within a rails plugin to copy some asset files (inside /assets in  
my plugin folder) to my rails application /public folder.  
How can I achieve this?

I am not sure whether to use FileUtils or File. Where AM I in rake  
terms. No matter what I do it keeps saying it can’t find the file. Do  
I need to use File.join or is there a better rake way? Any resources  
out there on how to use rake for file oriented tasks like this? Should  
I use a generator instead?

* * *

require ‘ftools’ #file tools

desc “Installs famfam icons and stylesheets in application”  
namespace :famfam do  
desc “famfam icons and stylesheets in application”  
task :install =\> :environment do  
puts "Copying famfam icons from …/assets/icons to " + RAILS\_ROOT

- “/public/styles”  
FileUtils.cd ‘…’  
puts FileUtils.pwd  
puts File.dirname( **FILE** )  
File.cp “/assets/icons”, RAILS\_ROOT + “/public/styles”  
end  
end
