目录我正在寻找这样的事情查找文件的数量和文件名,忽略了find命令
test1 : 2
aaa.txt
bbb.txt
test2 : 3
ababa.txt
cbbab.txt
ddddd.txt
test3 : 1
mmmm.txt
但我当前的代码列出的目录中。如何删除目录输出
这里是我的代码
find /tmp/test/ -maxdepth 2 -mindepth 1 -type d | while read dir; do printf "%s : " "$dir"; find "$dir" -maxdepth 1 -type f | wc -l; find "$dir" -maxdepth 1 -type f ; done;
我应该怎么改?该解决方案的
加-exec基本名不列入我发现相当发言工作 – user3897102
在上一个'find“$ dir”'命令中使用它。 – Barmar