Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6365727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:19:50+00:00 2026-05-25T00:19:50+00:00

In a rake task, how can I delete everything inside of the /public/assets folder?

  • 0

In a rake task, how can I delete everything inside of the /public/assets folder?

For deployment, we jammit the assets and the md5 has them, I would like a way to delete everything in assets before running jammit and the md5.

Any suggestions?

In the current rake task we have:

def get_file_paths
  Rake::FileList.new(
    './public/assets/*',
    './public/assets/**/*',
    './public/images/*',
    './public/images/**/*',
    './public/misc/*',
    './public/misc/**/*',
  )
end

def package_path
  file = open(config_file_path) {|f| YAML.load(f) }
  dir  = "public/" + (file["package_path"] || "assets")
end

Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:19:50+00:00Added an answer on May 25, 2026 at 12:19 am

    Clearly any solution you get here can be potentially very dangerous to execute or automate, so proceed with caution and thorough testing.

    `rm #{RAILS_ROOT}/public/images/*`
    

    You may also need to use sudo or certain flags depending on your needs.

    *Edit: To describe what is happening here: Using the backticks allows you to execute shell commands. You are executing the rm command and then defining the absolute path to your images folder. You can modify the path or command as you see fit. Also, keep in mind this means you can affect other parts of the filesystem unrelated to your project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my rails app I have a /public/assets directory. I'm writing a rake task
I have a Rakefile with a Rake task that I would normally call from
Can I do the following? def ModelObserver < ActiveRecord def after_save Rake::Task[name].invoke end end
How can I call specified 1st app's rake task from second one. Case: User
I would like to create a rake task or something to clear the browser
How can you do a conditional where clause? I have a rake task that
how can I create database logging for every rake task without changing source of
I can start server/console, run a rake task in local environment using the following
In rails 3.1 you can use the awesome rake task to copy in migrations
I need to define a rake task that can handle any amount of arguments,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.