明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1935|回复: 5

用LISP程序如何把一個文件夾的一個DWG文件拷貝到另外一個文件夾呀?

[复制链接]
发表于 2003-12-24 11:23:00 | 显示全部楼层 |阅读模式
如題. 不知哪位可以把一個文件夾的DWG文件用LISP程序拷到另外一個目錄里如到C盤,還是不行呢? 請舉個例謝謝!!
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2003-12-24 11:27:00 | 显示全部楼层
shell啊,你不是会用DOS命令吗
发表于 2003-12-24 11:27:00 | 显示全部楼层
准用VL吗?还是只用AutoLISP?
 楼主| 发表于 2003-12-24 11:43:00 | 显示全部楼层
謝謝Meflying and tukuitk 指點迷津, 真的不好意思我沒有用過SHELL 呢. 呵呵.
发表于 2003-12-25 07:59:00 | 显示全部楼层
將檔案的內容複製或附加到另一個檔案
(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 的典型原因是:

source-file 無法讀取
        source-file 是目錄
        append? 不存在或 nil 和 destination-file 存
        destination-file 無法開啟以供輸出 (也就是,它是無效的檔案名稱或防寫的檔案)
        source-file 相同於 destination-file

範例

將 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

複製成功,因為指定 T 給 append 引數。
发表于 2003-12-29 13:23:00 | 显示全部楼层
SHELL不爽,还是龙仔的方法爽:)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-10-2 06:38 , Processed in 0.190166 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表