FilesByWeek is a small script that counts the number of files in a folder that were created (or last modified) in X week of the year. It’s designed for use with Linux/Postfix Maildirs (and thus excludes the standard .Sent folder and any Dovecot/Courier IMAP files from the find query), but should work just fine on any kind of directory.
Get the latest version here. Or, if you just want to see what the fuzz is about:
#!/bin/bash
typeset -i YEAR WEEK COUNT
WEEK=$1
# Comment out the following line if the year starts on a Monday
WEEK=$((WEEK-1))
# Use current system year by default. This can be changed to e.g.: YEAR=2008
YEAR=`date +%Y`
TGTDIR=$2
COUNT=0
\find ${TGTDIR} \
-type d \( -name "*.sent" -o -name "*.Sent" -o -name "courierimapkeywords" -o -name "courierimaphieracl" \) -prune -o \
-type f \( ! -name "subscriptions" ! -name "courierimapsubscribed" ! -name "dovecot.index.log*" ! -name "dovecot.index" ! -name "maildirfolder" ! -name "dovecot-keywords" ! -name "dovecot.index.cache" ! -name "courierimapacl" ! -name "courierimapuiddb" ! -name "dovecot-uidlist" \) \
-print |
{
while read FILENAME; do
if [[ `\date +%Y-%W -r "${FILENAME}"` == ${YEAR}-${WEEK} ]]; then
# Uncomment to show the names of matching files
# echo ${FILENAME}
let COUNT++
fi
done
echo Week $1 -- ${TGTDIR}: ${COUNT}
}
exit 0
I didn’t know Erik, but after reading his critique of XML and one of his emails, I’m sure I would’ve liked to.
if you know what other people should have done in the past, you never have any clue what you or anyone else ought to do in the future, and if you are concerned with what you yourself ought to do in the future, you generally leave other people alone to figure out what they ought to do in the future, too.
people who partition the world population into “the good” and “the bad” always make the mistake of believing that they fall into the “the good” partition.
I keep telling people that you only really grow up and become a human being (as opposed to a mere animal) when you realize that most of what you think and almost all you feel is wrong.
Update: More by Erik Naggum.
Surprise, the warrant that was issued for a college student’s stuff on the basis that he was using an operating system with “white font on a black screen” has been thrown out, as no probable cause existed.
On May 21, 2009, Justice Botsford of the Supreme Judicial Court of Massachusetts granted our client Riccardo Calixte’s motion to quash the illegal search warrant with which it seized Calixte’s computers, phones, ipods, camera and other personal property. Not only is this an enormous victory for Calixte himself, but the ruling is also the highest state court opinion to repudiate the nascent law enforcement “trend” of charging internet users who violate websites’ terms of service as criminals. (Case page with background documents here.)