Remove ERB files after upgrading to haml

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.

Established 2005 · Databasically © 2016