Ced Ced - 1 year ago 80
Ruby Question

Ruby deleting directories

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



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

Ced Ced
Answer Source

Realised my error, some of the files hadn't been closed. I earlier in my program I was using


which I swapped for a

f = File.open(filename, "r")
while line = f.gets
    puts line

And now


works flawlessly

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download