File-Handling Functions Reference (AutoLISP)

 
 
 

The following table provides summary descriptions of the AutoLISP file-handling functions.

File-handling functions

Function

Description

(close file-desc)

Closes an open file

(findfile filename)

Searches the AutoCAD library path for the specified file

(findtrustedfile filename)

Searches the AutoCAD trusted file paths for the specified file

(open filename mode)

Opens a file for access by the AutoLISP I/O functions

(read-char [file-desc])

Returns the decimal ASCII code representing the character read from the keyboard input buffer or from an open file

(read-line [file-desc])

Reads a string from the keyboard or from an open file

(vl-directory-files [ directory pattern directories])

Lists all files in a given directory

(vl-file-copy "source-filename" "destination-filename" [append])

Copies or appends the contents of one file to another file

(vl-file-delete "filename")

Deletes a file

(vl-file-directory-p "filename")

Determines if a file name refers to a directory

(vl-file-rename "old-filename" "new-filename")

Renames a file

(vl-file-size "filename")

Determines the size of a file, in bytes

(vl-file-systime "filename")

Returns last modification time of the specified file

(vl-filename-base "filename")

Returns the name of a file, after stripping out the directory path and extension

(vl-filename-directory "filename")

Returns the directory path of a file, after stripping out the name and extension

(vl-filename-extension "filename")

Returns the extension from a file name, after stripping out the rest of the name

(vl-filename-mktemp ["pattern" "directory" "extension"])

Calculates a unique file name to be used for a temporary file

(write-char num [file-desc])

Writes one character to the screen or to an open file

(write-line string [file-desc])

Writes a string to the screen or to an open file