我需要通过 Go 编程语言执行这种命令:
find /some/dir/path -type f \( -iname \*.zip -o -iname \*.tar -o -iname \*.rar \)
我发现了 exec.Command 并尝试了各种执行find命令的方法,例如
exec.Command("find", dir, "-type", "f", "\\( -iname \\*.zip -o -iname \\*.tar -o -iname \\*.rar \\)")
exec.Command("find", dir, "-type", "f", "-iname", "*.zip", "-o", "-iname", "*.tar", "-o", "-iname", "*.rar")
exec.Command("find", dir, "-type", "f", "\\(", "-iname", "\\*.zip", "-o", "-iname", "\\*.tar", "-o", "-iname", "\\*.rar", "\\)")
以上都不适合我。有没有办法做到这一点,还是我只需要在 Go 中发出 3 个单独的 find 命令?
HUWWW
相关分类