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.
Written by Clément Herreman
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Related Tags
#bash
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#