将一个文件的内容复制或附加到另一个文件
(vl-file-copy source-file destination-file [append])
将一个文件的内容复制或附加到另一个文件。vl-file-copy 函数不会覆盖现有文件,而是将内容附加其后。
参数
source-file
字符串,指定要被复制的文件。如果未指定完整的路径名,vl-file-copy 将在 AutoCAD 启动目录中查找。
destination-file
字符串,指定目标文件。如果未指定完整的路径名,vl-file-copy 将内容写入 AutoCAD 启动目录中。
append
如果指定该参数且其值不为 nil,source-file 将附加到 destination-file (即复制到目标文件的尾部)。
返回值
如果复制成功则返回整数,否则返回 nil。
返回 nil 的几个典型原因包括:
示例
将 autoexec.bat 复制到 newauto.bat:
_$ (vl-file-copy "c:/autoexec.bat" "c:/newauto.bat")
1417
将 test.bat 复制到 newauto.bat:
_$ (vl-file-copy "c:/test.bat" "c:/newauto.bat")
nil
复制失败,因为 newauto.bat 已经存在,而又没有指定 append 参数。
重复上述命令,但指定 append 的值:
_$ (vl-file-copy "c:/test.bat" "c:/newauto.bat" T)
185
复制成功,因为指定 append 的值为 T。
明经通道 版权所有 未经许可 不得传播 | 评论 |