Tuesday, August 3, 2010

Shell script for increasing weekly

The ftp/sftp automatic job need to get the weekly increasing number for file filter. The following shell script works:

echo "Start at :" `date`
weeks=`date +%U`
myid=`expr $weeks + 1094`
filename="file[snh]name${myid}_*"
/usr/bin/sftp USERNAME@MACHINE.NAME << EOF
cd REMOTE/FOLDER
lcd LOCAL/FOLDER
mget $filename
quit
EOF
echo "End at :" `date`

No comments:

Post a Comment