View on GitHub

Tristan Hill

Blog about IT related stuff

Empty A Directory In Ruby

I find this a useful one liner to empty a directory (but keep forgetting it!):

FileUtils.rm_rf("#{dir_path}/.", secure: true)

from stackoverflow