Notifications
Clear all

[Closed] DeleteDir?

 PEN

So without going to dotNet or DOS is there a way in Max script to delete a directory? There is deleteFile but I have yet to be able to get it to delete a directory.

7 Replies

I’ve always done it with DOS, tis a shame. Though you could just create your own removeDir function with HiddenDOSCommand.

 PEN

What a pain.

Just going with this then and deal with it for Max 8 if I have to

dIO=dotNetClass "system.IO.directory"
dIO.delete (tempDir+"\\plugins") true

’tis indeed one of the great mysteries of maxscript file i/o; implementing a function to create a folder – but no function to delete it – seems like something that can’t be an oversight.

I’ve used dos as well, but might as well go with .NET for max9+

 PEN

I can’t even get del to work in dos to remove a directory, any help would be good. Problem with dotNet there is no error handling built in so if it gets to a file it can’t deal with it throws an error.

DOSCommand (“rmdir /s /q “+fullpath)

beware of the path you feed it, though; it will happily try to delete everything on your drive if you effectively tell it to.

 PEN

OH yes, I forgot about rmDir:) thanks. Ya I’m always a little scared the first time I test a script that deletes stuff.