Tags

, , , , , , , , , ,

Since it took me quite some time to find the right combination of commands and pipes I decided to post this example.

Scenario: I have several files(random amount) generated each day by one of the daemons that runs on my server. I needed a command that will display how many files per day were created. This method is omitting file names:

find /path/to/your/folder -maxdepth 1 -type f -printf ‘%TY-%Tm-%Td\n’ | sort -k3n,3 -k2M,2 -k1n,1 | uniq -c

Here’s an example of output:

29 2013-07-03
14 2013-07-04
25 2013-07-05
30 2013-07-06
29 2013-07-07

Advertisements