tas*_*ski 11 command-line find
我可以找到文件夹中所有文件的数量,但我得到了相当多的数量。
find . -type f | wc -l #find number of files in DIR
ls -lrt #list all files order by date
Run Code Online (Sandbox Code Playgroud)
如何找到标准日的文件数?
所以,结果应该是这样的:
# left number is number of files and right is one day.
109294 2016-06-27
101555 2016-06-26
88123 2016-06-25
... etc.
Run Code Online (Sandbox Code Playgroud)
hee*_*ayl 22
您可以使用 的printf
操作find
仅以所需格式打印修改时间,然后使用sort
和来执行此操作uniq
:
find . -type f -printf '%TY-%Tm-%Td\n' | sort | uniq -c
Run Code Online (Sandbox Code Playgroud)
-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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20779 次 |
最近记录: |