Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby deleting directories

Tags:

directory

ruby

I'm trying to delete a non-empty directory in Ruby and no matter which way I go about it it refuses to work. I have tried using FileUtils, system calls, recursively going into the given directory and deleting everything, but always seem to end up with (temporary?) files such as

.__afsECFC
.__afs73B9

Anyone know why this is happening and how I can go around it?

like image 982
Ced Avatar asked Sep 09 '12 00:09

Ced


2 Answers

require 'fileutils'  FileUtils.rm_rf('directorypath/name') 

Doesn't this work?

like image 73
Ismael Avatar answered Sep 20 '22 17:09

Ismael


Safe method: FileUtils.remove_dir(somedir)

like image 24
merqlove Avatar answered Sep 20 '22 17:09

merqlove