Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
gbra
Posts: 5
Registered: ‎05-12-2010
Message 1 of 5 (215 Views)

Manage files using Lips-routines

215 Views, 4 Replies
05-12-2010 07:31 AM
Hello,

Are there any Lisp functions to copy, rename and/or delete external files (not esp. drawings, could also be e.g. text files)?
*Expert Elite*
JGerth
Posts: 2,060
Registered: ‎12-05-2005
Message 2 of 5 (215 Views)

Re: Manage files using Lips-routines

05-12-2010 10:17 AM in reply to: gbra
take a look at the doslib library functions from McNeel.com
*andrew.nao
Message 3 of 5 (215 Views)

Re: Manage files using Lips-routines

05-12-2010 10:45 AM in reply to: gbra
(vl-file-delete filename)
Arguments

filename
A string containing the name of the file to be deleted. If you do not
specify a full path name, vl-file-delete searches the AutoCAD default
drawing directory.

Return Values

T if successful; nil if delete failed.

Examples

Delete newauto.bat:

_$ (vl-file-delete "newauto.bat")
nil
Nothing was deleted because there is no newauto.bat file in the AutoCAD
default drawing directory.

Delete the newauto.bat file in the c:\ directory:

_$ (vl-file-delete "c:/newauto.bat")
T
The delete was successful because the full path name identified an existing
file.
*andrew.nao
Message 4 of 5 (215 Views)

Re: Manage files using Lips-routines

05-12-2010 10:47 AM in reply to: gbra
(vl-file-rename old-filename new-filename)
Arguments

old-filename
A string containing the name of the file you want to rename. If you do not
specify a full path name, vl-file-rename looks in the AutoCAD default
drawing directory.

new-filename
A string containing the new name to be assigned to the file.

NoteIf you do not specify a path name, vl-file-rename writes the renamed
file to the AutoCAD default drawing directory.
Return Values

T, if renaming completed successfully; nil if renaming failed.

Examples

_$ (vl-file-rename "c:/newauto.bat"
"c:/myauto.bat")
T
NoteIf the target file already exists, this function fails.
Member
gbra
Posts: 5
Registered: ‎05-12-2010
Message 5 of 5 (215 Views)

Re: Manage files using Lips-routines

05-25-2010 12:02 AM in reply to: gbra
Thanks!
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.