Renames a file
Supported Platforms: Windows, Mac OS, and Web
Signature
(vl-file-rename old-filename new-filename)
- old-filename
-
Type: String
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
-
Type: String
New name to be assigned to the file.
Note: If you do not specify a path name, vl-file-rename writes the renamed file to the AutoCAD default drawing directory.
Return Values
Type: T or nil
T, if renaming completed successfully; nil if renaming failed.
Note: If the target file already exists, this function fails.
Release Information
- AutoCAD R14 and later on Windows
- AutoCAD 2011 and later on Mac OS
Releases:
History
- old-filename and new-filename arguments previously accepted ASCII text strings, but they now accept Unicode text strings.
- LISPSYS system variable controls which AutoLISP engine is used and the behavior of the function.
- 0 - ASCII character support (legacy behavior)
- 1 or 2 - Unicode character support
Note: After the value of the LISPSYS system variable has been changed, AutoCAD must be restarted for the change to take affect.
AutoCAD 2021
Examples
- Windows
-
(vl-file-rename "c:/newauto.bat" "c:/myauto.bat") T
- Mac OS and Web
-
(vl-file-rename "/oldstartup.sh" "/mystartup.sh") T