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 find and date.

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.


Platform Version Package Size
Linux 1.0 – 2009-06-20 (right-click -> Save as…) 3.2 KB
Git repository Development


./filesbyweek <week> [dir]


  • ./filesbyweek 24 — scans the current directory for files created in week 24.
  • ./filesbyweek 24 /var/mail/ — scans /var/mail/ for files/emails created/received in week 24.


  • Linux with bash, date, and find (all available in most distributions).


  • If the script won’t run, make it executable with the command: chmod +x
  • The date command 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 %W to %U within the date call inside the script.
  • date starts 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.