ftp a file after checking the versions not greater then 8 in archive directory

Hi ,

I want to write a FTP Script which checks the No of Vesions of the files in Archive Dir and if count >= 8 Delete the oldest file from the Archive Dir and if the count is <= 8 Move the file to the Archive Dir with a CurrentDate concatenation and FTP the file to the FTP directory and send the same file to a email list(group).

Any help will be really appreciated .

Thanks

Better write a script in combination of ssh and scp commands. ftp might be too limited to do things like checking versions etc. Also it is not encrypted.