我想执行find
多个条件,例如:查找foo排除隐藏文件:
find . -type f \( -iname '*foo*' ! -name '.*' \)
Python代码:
import subprocess
cmd = ["find", ".", "-type", "f", "(", "-iname", "*foo*", "!", "-name", ".*", ")"]
sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print sp.communicate()[0].split()
有人可以解释我错过了什么吗?谢谢!