我可以在文件夹中找到所有文件的数量,但我得到了相当大的数字。
find . -type f | wc -l #find number of files in DIR
ls -lrt #list all files order by date
如何找出文件日均数量?
因此,其结果应该是:
# left number is number of files and right is one day.
109294 2016-06-27
101555 2016-06-26
88123 2016-06-25
... etc.
发布于 2016-06-27 00:47:08
您可以使用printf
操作find
只打印所需格式的修改时间,然后使用sort
和uniq
:
find . -type f -printf '%TY-%Tm-%Td\n' | sort | uniq -c
-printf '%TY-%Tm-%Td\n'
以2015-05-23
格式打印文件的修改时间sort
对输出进行排序,uniq -c
按日期进行计数。~/foobar% find . -type f -printf '%TY-%Tm-%Td\n' | sort | uniq -c
3 2004-06-29
1 2004-08-23
1 2004-09-15
1 2004-09-18
1 2005-07-24
1 2006-02-05
2 2008-06-25
3 2008-12-31
1 2009-03-13
1 2009-04-30
1 2010-04-04
2 2010-09-01
8 2011-07-13
15 2011-08-27
3 2011-11-03
3 2014-10-08
https://askubuntu.com/questions/791864
复制相似问题