【发布时间】:2018-12-10 08:32:45
【问题描述】:
我有几个 git 存储库,我想计算它们包含多少 .txt、目录和其他文件。问题是每个存储库内都有一个包含更多文件和配置的 .git 目录。我也不想计算我正在寻找的文件夹,或 .git 目录或其包含的文件。我使用以下命令:
all="$(find $repo -path "$repo"/.git -prune -o type f)"
dirs="$(find $repo -path "$repo"/.git -prune -o type d)"
txts="$(find $repo -path "$repo"/.git -prune -o type f -iname "*.txt")"
$repo 是我的存储库的路径,它看起来像 assignments/repo1 assignments/repo2 等。
所有这些 find 迭代仍在 .git 内部并在那里列出所有内容。我是在犯语法错误还是什么?
【问题讨论】:
-
你的意思是
$repo包含两个目录吗?