I have a
public/cache folder which has files and folders. How can I completely empty that folder using a rake task?
Ruby has the *nix’s
rm -rf in the the FileUtils module that you can use to delete both files and non-empty folders
To keep the directory itself and only remove its contents:
You can run arbitrary commands using the tilted single-quote (next to the tilde) like so:
`rm -fr public/cache/*`
This may be more platform-dependent than what you want, but it opens up a lot of possibilities.