这是我当前的目录结构
/ <-- current working Dir
/php/
file1.php
file2.php
file3.txt
我正在尝试执行以下常规命令
def cp = 'cp -f *.php /tmp/'
def cpProc = cp.execute(null, new File('./php/')
cpProc.waitfor()
log.info 'current exitvalue :' + cpProc.exitValue()
log.info 'current proc out : ' + cpProc.text
但我不断得到cp: cannot stat *.php': No such file or directory
,我已经验证了文件存在并且我已经验证了我当前的工作目录
如果我执行log.info 'ls -la'.execute(null, new File('./php/'))
,我会看到 PHP 和 .txt 文件。
这似乎是一个长镜头,但我认为在指定的工作目录中执行命令时使用通配符可能存在错误,除非我遗漏了什么?
我正在使用 groovy 1.7.5