Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Deleting a non empty directory
Kostas Zoumbatianos
6/18/2007 5:32:00 PM
Hi, I am getting an exception when I use Dir.delete on a non empty
directory.
What should I do to remove a non empty directory?
Thanks,
Kostas
--
Posted via
http://www.ruby-...
.
3 Answers
Kaldrenon
6/18/2007 6:29:00 PM
0
On Jun 18, 1:32 pm, Kostas Zoumbatianos <zoumbatia...@gmail.com>
wrote:
> Hi, I am getting an exception when I use Dir.delete on a non empty
> directory.
> What should I do to remove a non empty directory?
>
> Thanks,
> Kostas
>
> --
> Posted via
http://www.ruby-...
.
Use Dir.each to iterate over the items in the dir, and call
File.delete on them. Then call Dir.delete.
bmunat@gmail.com
6/18/2007 6:38:00 PM
0
On Jun 18, 8:28 am, Kaldrenon <kaldre...@gmail.com> wrote:
> On Jun 18, 1:32 pm, Kostas Zoumbatianos <zoumbatia...@gmail.com>
> wrote:
>
> > Hi, I am getting an exception when I use Dir.delete on a non empty
> > directory.
> > What should I do to remove a non empty directory?
>
> > Thanks,
> > Kostas
>
> > --
> > Posted via
http://www.ruby-...
.
>
> Use Dir.each to iterate over the items in the dir, and call
> File.delete on them. Then call Dir.delete.
Or use FileUtils::rm_rf:
http://www.ruby-doc.org/core/classes/FileUtils.ht...
Be careful though. ;-)
b
Kostas Zoumbatianos
6/18/2007 8:48:00 PM
0
bmunat@gmail.com wrote:
> On Jun 18, 8:28 am, Kaldrenon <kaldre...@gmail.com> wrote:
>> > --
>> > Posted via
http://www.ruby-...
.
>>
>> Use Dir.each to iterate over the items in the dir, and call
>> File.delete on them. Then call Dir.delete.
>
> Or use FileUtils::rm_rf:
>
>
http://www.ruby-doc.org/core/classes/FileUtils.ht...
>
> Be careful though. ;-)
>
> b
Thanks a lot!
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Deleting a non empty directory
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password