Last Updated: February 25, 2016
·
344
· clemherreman

How many files do my users upload every day ?

I needed to know how much images are uploaded everyday on an app, so I used some bash-fu :

cd /web/uploads
find . -type f | xargs -I {} date -r {} +%F | sort | uniq -c

Let's break it down :

find . -type f

List all the files uploaded ever.

| xargs -I {} date -r {} +%F

Print the date of creation of each file found

| sort | uniq -c

uniq tells you how many times the same date is printed, but work only on consecutive duplicate, so sort puts the duplicate consecutively.