script to archive certain folders in a hierarchy

I'm new to shell scripting and I'm having a tough time figuring out how to script something. Can anyone help?

Here is my setup and what I want to do:

A directory contains a list of projects by year (2000, 2001, etc) and customers (01-001) all of which have the same internal directory setup (1-Current Drawings, 2-Quotes etc...) So like this:

/Server/Projects/2000/001-001/
/Server/Projects/2000/001-002/
etc..
/Server/Projects/2001/005-0045/
/Server/Projects/2001/005-0045/
etc...

Remember EACH of these directories have the same internal folder structure like

1-Current Drawings
2-Quotes
3-Invoices
4-Archived Drawings
etc...

What I want to do is ZIP or TAR the 1-Current Drawings directory (leave the files loose however), move the created archive into the 4-Archived Drawings directory and time stamp the archive name and do this for EACH directory in Projects directory.

So basically some sort of loop to enumerate the Projects in each year and customer, find the 1-Current Drawings, archive it, move it into the appropriate folder of each customer, timestamp the archive, move on to the next customer and year.

In my mind this should be easy but shell scripting is not my forte.

If someone can give a short example that works on a given structure I can probably handle the rest and customize it to my liking. Thanks!

Hi,

This should do the job :

#!/bin/sh
WD=/home/slava/forum

TODAY=`date +%d%m%y`

cd "$WD"
for YEAR in `ls -d 2???`
do

cd "$WD/$YEAR"
for PROJECT in `ls -d ???-?*`
do

if [ -d "$WD/$YEAR/$PROJECT/1-Current Drawings" ]
then
   cd "$WD/$YEAR/$PROJECT"
   tar cfv \\
	"1-Current Drawings.$TODAY.tar" \\
	 "1-Current Drawings" >/dev/null
   mkdir -p "$WD/$YEAR/$PROJECT/4-Archived Drawings"
   mv "1-Current Drawings.$TODAY.tar" \\
      "$WD/$YEAR/$PROJECT/4-Archived Drawings/"

fi

done

done

Slava R.

OK great, so far so good however one little problem..

On an OS X system, some directories with spaces in the name can be escaped as such:

05-028\ West\ Oak\ Trails

On an ls -d ??-* file listing everything is ok but the script kaks where it detects the projects listing. It's balking at the spaces in the name.

sh -x ./script reports that part as such:

+ '[' -d /Volumes/230GB/SDG/1-Projects/2005/05-067/ ']'
+ '[' -d /Volumes/230GB/SDG/1-Projects/2005/Laffey/ ']'
+ '[' -d /Volumes/230GB/SDG/1-Projects/2005/House/ ']'

That directory is supposed to be 05-067 Laffey House

Is there a way to prevent the script from munging the directory name and keeping it all on 1 line??

One I fix this I'm good to go! Greta script, I learned a lot from it.

change:
for PROJECT in `ls -d ???-?*`

TO
for PROJECT in "`ls -d ???-?*`"