here i have a transfer script that draws files by date but now we have to add time in the files format according to the generation time of those files and that made it difficult to modify the script...
could you please suggest and see whats the prob in it....
i want the script to automatically understand the files that get generated in different timings a day and knows whats the next file should be gotten.
here is the script:
REP=/u05/home/Nael
#read a < $REP/last_file
read a < $REP/najib/naeltestCDR
echo $a
y=`echo $a | cut -c17-20`
m=`echo $a | cut -c21-22`
d=`echo $a | cut -c23-24`
H=`echo $a | cut -c26-27`
M=`echo $a | cut -c28-29`
S=`echo $a | cut -c30-31`
y_next=$y
m_next=$m
d_next=$d
H_next=$H
M_next=$M
S_next=$S
if [ $d -eq 31 ] || ( [ $d -eq 30 ] && ( [ $m -eq 04 ] || [ $m -eq 06 ] || [ $m -eq 09 ] || [ $m -eq 11 ] ) )
then
d_next=01
if [ $m -eq 12 ]
then
m_next=01
y_next=`expr $y + 1`
else
m_next=`expr $m + 1`
if [ $m_next -le 9 ]
then
m_next=0$m_next
fi
fi
else
if [ $d -eq 28 ] && [ $m -eq 2 ]
then
d_next=01
m_next=03
else
d_next=`expr $d + 1`
if [ $d_next -le 9 ]
then
d_next=0$d_next
fi
fi
fi
next_file=VXT_CDR_305_333_$y_next$m_next$d_next_$H_next$M_next$S_next.DAT
echo $next_file
> $REP/.netrc
chmod 600 $REP/.netrc
echo "machine jinny" >> $REP/.netrc
echo "login username" >> $REP/.netrc
echo "password passwd" >> $REP/.netrc
echo "macdef init" >> $REP/.netrc
echo " binary" >> $REP/.netrc
echo " prompt off" >> $REP/.netrc
echo " lcd /u05/home/Nael/najib/Jinny" >> $REP/.netrc
echo " cd vxt" >> $REP/.netrc
echo " mget $next_file" >> $REP/.netrc
echo " quit\n" >> $REP/.netrc
ftp jinny > ftp_305.log
ls /u05/home/Nael/najib/Jinny > /u05/home/Nael/najib/Jinny/list_305.log
if grep $next_file /u05/home/Nael/najib/Jinny/list_305.log > /dev/null
#if [ $? -eq 1 ]
then
echo $next_file > /u05/home/Nael/najib/last_jinny_305
chmod 774 /u05/home/Nael/najib/Jinny/$next_file
echo $next_file >> ftp_305.log
echo " Transfer is Successful" >> ftp_0.log
fi
exit
Thank you very much for your cooperation....