EDA365电子工程师网

标题: 请教:SKILL如何使用通配符进行文件拷贝 [打印本页]

作者: yneda    时间: 2012-7-26 17:08
标题: 请教:SKILL如何使用通配符进行文件拷贝
本帖最后由 yneda 于 2012-7-26 17:10 编辑

如题,我想做一个操作,我想把gerber文件夹里面的文件copy到另外一个文件外夹里,比如xxx-gerberout,记的有个这样的命令挺好用的

COPY *.art ./xxx-gerberout,类似的功能,在SKILL里如何现实,我找到一个函数,但只能对单个文件copy有用:sigCopyFile()
多个的没找到,求达人指点下,谢谢!{:soso_e181:}
作者: betamelody    时间: 2012-7-26 17:32
试试
  1. shell("copy c:\\*.txt c:\\1\\")
复制代码

作者: XYX365    时间: 2012-7-27 08:11
axlOSFileCopy
axlOSFileCopy(t_src  t_dest  g_append)
⇒ t/nil

Description
Copies a given source file to a given destination with optional append.

Arguments
t_src Full path of the source file.
t_dest Full path of the destination file.
g_append Flag for the append function (t/nil)

Value Returned
t Copied file.
nil Failed to copy file due to incorrect arguments.

Example
unless(axlOSFileCopy("~/myfile" "~/newfile" nil)
axlUIConfirm("file copy FAILED") )
作者: betamelody    时间: 2012-7-27 10:51
想要用skill函数来完成通配符操作比较困难 axlOSFileCopy应该不支持通配符
要是想写的话应该是这个思路,用相应的正则表达式字串来匹配替换通配符的"? *"  然后再用重新整理过的正则表达式去匹配相应的文件名,如果匹配上了就执行拷贝操作
以下是几个能用到的函数
simplifyFilename
axlDMFileParts
rexReplace
rexMatchList
作者: zm0202    时间: 2012-8-10 00:06
getDirFiles 以及 rexMatchList 就可搞定, 但须了解简单的正则表达式基础。
例如:获取当前路径下所有以cds_开头的文件
rexMatchList("^cds_"   getDirFiles("."))
大小写敏感哦, 之前需统一文件大小写a =   mapcar( 'lowerCase  getDirFiles("."))
或者直接使用foreach 和 rexMatchp 搞定, 简单好懂
Copy的方法就是上楼兄弟说的axlOSFileCopy

看看二楼的兄弟实在, 哈哈, 如果不专玩SKILL, 那个方法最简单, 就是会闪黑框




欢迎光临 EDA365电子工程师网 (https://bbs.elecnest.cn/) Powered by Discuz! X3.2