Delete a non empty directory

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

Delete a non empty directory

Postby Tranber44 on Fri Aug 01, 2014 12:10 pm

Hello,

The use of Files.RmDir does not allow, it seems to me, to delete a not empty directory, the parameters /s/q not being accepted. Is there a solution avoiding me erasing 500 files one by one?

Best regards

Bertrand Delassus
Tranber44
 
Posts: 34
Joined: Mon Jan 11, 2010 4:46 pm

Re: Delete a non empty directory

Postby DanB|Dyalog on Fri Aug 01, 2014 9:12 pm

You are correct. This program assumes the directory is empty.
You can always do (under Windows)
Code: Select all
 ⎕CMD 'rmdir c:\folder\to\remove /s /q'
DanB|Dyalog
 

Re: Delete a non empty directory

Postby PGilbert on Sat Aug 02, 2014 12:49 am

You can try the following with .Net that will erase a directory (and subdirectory) even when not empty:

      ⎕USING←',mscorlib.dll'
System.IO.Directory.Delete((⊂,path),1)


The full explanation of Directory.Delete is here.
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: Delete a non empty directory

Postby Tranber44 on Sat Aug 02, 2014 3:39 pm

@PGilbert : Thank you very much, it works perfectly.

Regards

Bertrand Delassus
Tranber44
 
Posts: 34
Joined: Mon Jan 11, 2010 4:46 pm


Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest