奇宝库 > linux查看文件夹下一类文件数量(linux 查看文件夹里文件的数目)

linux查看文件夹下一类文件数量(linux 查看文件夹里文件的数目)

发现命令查看(推荐):

所有子目录的数量:

[root@localhost ~]#查找xker mulu-d型| wc -l

125

[root @ localhost ~]# find xker mulu/-type d | WC-l

125

[root @ localhost ~]# find xker mulu/*-type d | WC-l

124 - 正确

结果不同的原因:

[root@localhost ~]#查找xkermulu-d型|更多

克姆鲁-输出结果首行

[root @ localhost ~]#查找xker mulu/*-type d |更多

xker mulu/示例-输出结果首行

总结:使用xkermulu/*不包含许克穆卢这个父目录,只输出其下的子目录。

所有文件的数量:

[root@localhost ~]#查找xkermulu -type f | wc -l

987

[root @ localhost ~]# find xker mulu/-type f | WC-l

987

[root @ localhost ~]# find xker mulu/*-type f | WC-l

987

树命令查看(不推荐):

[root@localhost ~]# tree xkermulu

……

124个目录,984个文件

-

[root @ localhost ~]# tree xker mulu/

……

124个目录,984个文件

杜(姓氏)命令查看:

[root @ localhost ~]# du-ah xker mulu/* | WC-l

1111

总结:杜查看的结果为1111,子目录的数量为124,文件数量为:1111-124=987,所以树命令查看的结果应该是不准确,至于少计算了哪个文件,没再查这个问题,推荐使用发现命令查看。

本文来自网络,不代表本站立场,转载请注明出处: