#!/bin/sh

if [ ! $1 ]; then echo "Give the working dir!"; exit 127; fi

dir=$1
ydir=$(date +"%Y")
mdir=$(date +"%m")
ddir=$(date +"%d")

dest=$dir/$ydir/$mdir/$ddir

if [ ! -d $dest ]; then
        mkdir -p $dest
fi

for i in $dir/irc*; do
	cp $i $dest; cat /dev/null > $i
done
