How to delete all contents of a folder with Ruby-Rails?

前端 未结 3 1137
长发绾君心
长发绾君心 2021-02-02 05:09

I have a public/cache folder which has files and folders. How can I completely empty that folder using a rake task?

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-02 05:36

    Great answers here already. You might also be interested to know that Rails 5 has a rake task to do this built-in:

    rake tmp:cache:clear # Clear cache files from tmp/
    

提交回复
热议问题