Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Member
nn.araujo
Posts: 6
Registered: ‎12-29-2010
Message 1 of 4 (672 Views)
Accepted Solution

Delete folder command

672 Views, 3 Replies
01-07-2011 10:59 AM

Hi everybody

 

I need to delete a folder (not empty) in my LISP routine and I’m not being able to do so. I created the folder using (vl-mkdir “foldername”) but I don’t find the equivalent command to remove it. Any help?

 

Thanks

Nuno

This delete the folder and its content:

(setq FSO (vlax-create-object "Scripting.FileSystemObject"))
(vlax-invoke FSO "DeleteFolder" "D:\\folder1\\folder2\\Prog\\AutoLISP\\deletme" :vlax-true)

at the end release the FSO:

(vlax-release-object FSO)

 

Hope this helps.

 

Justo Aguiar.

Valued Contributor
JustoAg
Posts: 80
Registered: ‎09-23-2008
Message 2 of 4 (663 Views)

Re: Delete folder command

01-07-2011 12:22 PM in reply to: nn.araujo

This delete the folder and its content:

(setq FSO (vlax-create-object "Scripting.FileSystemObject"))
(vlax-invoke FSO "DeleteFolder" "D:\\folder1\\folder2\\Prog\\AutoLISP\\deletme" :vlax-true)

at the end release the FSO:

(vlax-release-object FSO)

 

Hope this helps.

 

Justo Aguiar.

Active Member
nn.araujo
Posts: 6
Registered: ‎12-29-2010
Message 3 of 4 (644 Views)

Re: Delete folder command

01-09-2011 02:51 AM in reply to: nn.araujo

Hello Just Aguiar,

 

It works perfectly. I just change from absolute path to local path (vlax-invoke FSO "DeleteFolder" ".\\foldername" :vlax-true). Problem solved!

 

Thanks

Nuno

Valued Contributor
anovelli
Posts: 76
Registered: ‎05-18-2004
Message 4 of 4 (467 Views)

Re: Delete folder command

03-29-2011 12:35 PM in reply to: nn.araujo

Any way to use a while card?

 

I want to delete all the Background Plot folders.

 

For me they are created in C:\Temp\BGPlot_2552 but the number varies.

 

Please let me know.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.