Remove ERB files after upgrading to haml

Posted Posted by Wes in Ruby on Rails     Comments No comments
Jun
10

I converted an application to haml and wanted to get rid of my previous ERb templates.

find ./app/views -name "*.html.erb" -print0 | xargs -0 rm

Explanation

  • find() ./app/views -name "*.html.erb" returns a list of all ERb view templates.
  • -print0 formats the output specially.
  • xargs is a program that takes a list and runs a command for each item in that list.
  • -0 means the input format is specially formatted by -print0
  • rm is the command we want to run for each found file

So, each found file will get deleted. Bask in your newfound haml-ness.

Post comment

about databasically

We live and work in Kansas City, USA.

We're passionate about helping small businesses succeed and want to help you use technology to get more done.

From server, desktop, network management to programming custom web applications in Ruby on Rails, we're here to lend a hand.

Contact us if you have any questions!