Zip files by date

Hello,

I need to create a bash script file that zip files.
The obj is : the script enter into a directory, see all directories, and zip the files by date ( the script is for managment of logfiles ), exemple: in the directory there is just files following the name "ex090210" (yymmdd ), so i need the script reads "*0902*" create a zip with that name and everything that have *0902* goes into the zip, so script will zip files by month, and do that recursivelly.

Tks for the atention.

This should work for you.

YYMM=$1 # for instance
LOGDIR=$2 # for instance
test -z $YYMM -o -z $LOGDIR && { echo >&2 "Usage: $0 DATE(YYMM) LOGDIR"; exit 1; }
OUTPUT_DIR=/tmp # for instance
find $2 -type f -name "*${YYMM}*" -print |  
zip -q -@ $OUTPUT_DIR/$YYMM.zip 

The -@ parameter takes the filenames from standard input, one line at a time. Conveniently (or perhaps by design), the find command outputs one line per file that matches the pattern.