FilesByWeek is a Linux shell (
bash) script that lets you check how many files in a directory were created (or last modified) in a certain week of the year, using Linux’s
It was designed to count the number of emails received in a few Linux/Postfix Maildirs every week (and thus excludes .Sent and any Courier/Dovecot IMAP files), but can be used on any kind of folder.
|Linux||1.0 – 2009-06-20||filesbyweek.sh (right-click -> Save as…)||3.2 KB|
./filesbyweek <week> [dir]
./filesbyweek 24— scans the current directory for files created in week 24.
./filesbyweek 24 /email@example.com— scans /firstname.lastname@example.org for files/emails created/received in week 24.
find(all available in most distributions).
If the script won’t run, make it executable with the command:
chmod +x filesbyweek.sh
datecommand used in FilesByWeek considers Monday the first day of the week. If you would like Sunday to be the first day of the week, change
datecall inside the script.
datestarts counting weeks on the first Monday (or Sunday) in a new year, which we work around by subtracting 1 from the week count inside the script. However, if the year actually does start on a Monday, you should comment out
WEEK=$((WEEK-1))inside the script.
FilesByWeek is released under the MIT license.