script help .. archive

Hi All
We have a landing directory where source system puts files.There are variable number of files and the file names are also varying.Each files successful transmission is identified by a .done file.If file name is xyz.dat then the confirmation file will be xyz.dat.done.

I want to archive the files to a date folder structure.For all the files received on 25-apr-09 will be archived to 25apr09 directory.The script should run all the times looking for newly arrived file.

We can't remove the files from the landing dir because others may use that

Yeah, you can do something like:

DATE=`date +%d%b%Y`
find /landing/dir -type f -daystart -mtime 0 | 
zip -q -@ -u /archive/$DATE/archive.zip  || echo "Archive Failed"

Put this in a cronjob to run however often you want (make sure two aren't running at the same time, however). You can use -0 (dash-zero) option to disable compression; useful if these files are really big. It will archive all files from today. If a file is updated/overwritten, it will be overwritten in the archive file as well.