I have a script that is run each night by cron. This script generates an extract then places it into an 'extracts' folder and also ftp's a copy to another server.
I have set up the script to remove any files in the extracts folder greater than 28 days old (this occurs each time the script is run). This is the command.
find ${WORKdir}/extracts/ -mtime +29 -exec rm {} \; &&
Now I also want this function to occur in the folder on the other server - preferably using ftp. Here is the ftp activity I already have.
if [ -s ${EXTfile} ]
then
ftp -n ${FTPserver} << cmd
user ${FTPid} ${FTPpwd}
cd ${FTPlocation}
lcd ${WORKdir}/extracts
put ${SHORTfile}
quit
cmd
fi
Can FTP do anything like this - by using unix commands somehow?